Parcourir la source

新增ERP Mobile 创建hang tag 数据访问接口,并修改相关调用。
新增ERP Mobile 创建backorder 数据访问接口,并修改相关调用。
新增ERP Mobile email wishlist 数据访问接口,并修改相关调用。
新增ERP Mobile notify me 数据访问接口,并修改相关调用。
新增ERP Mobile quote order 数据访问接口,并修改相关调用。
去掉ERP Mobile 不再使用的 lock order接口。
新增ERP Mobile merge order 数据访问接口,并修改相关调用。

Ray Zhang il y a 6 ans
Parent
commit
10f96199ec

+ 538 - 237
RedAnt ERP Mobile/common/CartUtils.m

@@ -351,80 +351,229 @@
 
 
             }
-
             else
-
             {
 
                 UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Checking Pending Order"];
 
 
-
-
-                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-
-                    NSDictionary* return_json = [RANetwork request_PendingOrder:appDelegate.contact_id];
-
-                    dispatch_async(dispatch_get_main_queue(), ^{
-
-                        [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-
-                        if([[return_json valueForKey:@"result"] intValue]==2)
+                [RANetwork request_pendingorder:appDelegate.contact_id completionHandler:^(NSMutableDictionary *result) {
+                    NSMutableDictionary* return_json =result;
+                    
+                    
+                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                    
+                    if([[return_json valueForKey:@"result"] intValue]==2)
+                    {
+                        
+                        bool openPendingOrder= [[return_json valueForKey:@"hasPending"] boolValue];
+                        bool createNewOrder=appDelegate.can_create_order;
+                        
+                        if(openPendingOrder&&createNewOrder)
                         {
-
-                            bool openPendingOrder= [[return_json valueForKey:@"hasPending"] boolValue];
-                            bool createNewOrder=appDelegate.can_create_order;
-
-                            if(openPendingOrder&&createNewOrder)
+                            
+                            NSString* msg =@"";
+                            if(appDelegate.contact_id.length>0)
+                            {
+                                msg = [msg stringByAppendingString:@"Customer:"];
+                                msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+                                
+                            }
+                            
+                            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
+                            //block代码块取代了delegate
+                            
+                            
+                            
+                            UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+                                
+                                
+                                //  vc.disable_refresh = true;
+                                OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
+                                ovc.showNavibar = true;
+                                ovc.customer_id = appDelegate.contact_id;
+                                ovc.selectOrder = ^(NSMutableDictionary* order_detail){
+                                    
+                                    [holder performSelector:addtocart];
+                                    
+                                    
+                                };
+                                ovc.init_style = OL_OPEN;
+                                
+                                ovc.onCancel = ^(){
+                                    
+                                    //  self.disable_refresh = false;
+                                    
+                                    
+                                    
+                                };
+                                
+                                [vc.navigationController pushViewController:ovc animated:true];
+                                
+                                
+                                
+                                
+                                
+                            }];
+                            
+                            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+                                
+                                
+                                {
+                                    //create new;
+                                    //    self.disable_refresh = true;
+                                    if(appDelegate.customerInfo==nil)// select contact if current contact not exist
+                                    {
+                                        ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
+                                        cvc.showNavibar = true;
+                                        cvc.contact_type = @"Sales_Order_Customer";
+                                        cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
+                                            
+                                            appDelegate.contact_id=[value valueForKey:@"customer_cid"];
+                                            appDelegate.customerInfo = value;
+                                            
+                                            
+                                            if(appDelegate.order_code==nil)
+                                                [self neworder:vc selectorholder:holder selector:addtocart];
+                                            //                                                            neworder();
+                                            
+                                            //    [main_vc checklogin:true];
+                                            //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
+                                            
+                                            //
+                                            //                if(self.returnValue)
+                                            //                    self.returnValue(value);
+                                        };
+                                        
+                                        cvc.onCancel = ^(){
+                                            
+                                            [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
+                                            
+                                            // self.disable_refresh = false;
+                                            
+                                        };
+                                        cvc.onReset = ^(){
+                                            // [main_vc checklogin:true];
+                                        };
+                                        
+                                        [vc.navigationController pushViewController:cvc animated:true];
+                                    }
+                                    else
+                                    {
+                                        [self neworder:vc selectorholder:holder selector:addtocart];
+                                    }
+                                    
+                                }
+                                
+                                
+                                DebugLog(@"No");
+                            }];
+                            [alertControl addAction:actionOne];
+                            
+                            [alertControl addAction:alertthree];
+                            
+                            UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+                            }];
+                            [alertControl addAction:alertcancel];
+                            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+                            
+                            
+                            [vc presentViewController:alertControl animated:YES completion:nil];
+                            
+                            
+                            
+                            
+                            
+                            
+                        }
+                        else
+                        {
+                            if(openPendingOrder)
                             {
-
                                 NSString* msg =@"";
                                 if(appDelegate.contact_id.length>0)
                                 {
                                     msg = [msg stringByAppendingString:@"Customer:"];
                                     msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-
+                                    
                                 }
-
+                                
                                 UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
                                 //block代码块取代了delegate
-
-
-
+                                
+                                
+                                
                                 UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
+                                    
+                                    
                                     //  vc.disable_refresh = true;
                                     OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
                                     ovc.showNavibar = true;
                                     ovc.customer_id = appDelegate.contact_id;
                                     ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-
+                                        
                                         [holder performSelector:addtocart];
-
-
+                                        
+                                        
                                     };
                                     ovc.init_style = OL_OPEN;
-
+                                    
                                     ovc.onCancel = ^(){
-
+                                        
                                         //  self.disable_refresh = false;
-
-
-
+                                        
+                                        
+                                        
                                     };
-
+                                    
                                     [vc.navigationController pushViewController:ovc animated:true];
-
-
-
-
-
+                                    
+                                    
+                                    
+                                    
+                                    
                                 }];
-
+                                
+                                
+                                [alertControl addAction:actionOne];
+                                UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+                                }];
+                                [alertControl addAction:alertcancel];
+                                
+                                //   [alertControl addAction:alertthree];
+                                
+                                //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+                                
+                                
+                                [vc presentViewController:alertControl animated:YES completion:nil];
+                                
+                                
+                                
+                                
+                                
+                                
+                                
+                            }
+                            else if(createNewOrder)
+                            {
+                                NSString* msg =@"";
+                                if(appDelegate.contact_id.length>0)
+                                {
+                                    msg = [msg stringByAppendingString:@"Customer:"];
+                                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+                                    
+                                }
+                                
+                                UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
+                                //block代码块取代了delegate
+                                
+                                
+                                
+                                
+                                
                                 UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
+                                    
+                                    
                                     {
                                         //create new;
                                         //    self.disable_refresh = true;
@@ -434,239 +583,391 @@
                                             cvc.showNavibar = true;
                                             cvc.contact_type = @"Sales_Order_Customer";
                                             cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-
+                                                
                                                 appDelegate.contact_id=[value valueForKey:@"customer_cid"];
                                                 appDelegate.customerInfo = value;
-
-
+                                                
+                                                
                                                 if(appDelegate.order_code==nil)
                                                     [self neworder:vc selectorholder:holder selector:addtocart];
                                                 //                                                            neworder();
-
+                                                
                                                 //    [main_vc checklogin:true];
                                                 //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-
+                                                
                                                 //
                                                 //                if(self.returnValue)
                                                 //                    self.returnValue(value);
                                             };
-
+                                            
                                             cvc.onCancel = ^(){
-
+                                                
                                                 [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
-
+                                                
                                                 // self.disable_refresh = false;
-
+                                                
                                             };
                                             cvc.onReset = ^(){
                                                 // [main_vc checklogin:true];
                                             };
-
+                                            
                                             [vc.navigationController pushViewController:cvc animated:true];
                                         }
                                         else
                                         {
                                             [self neworder:vc selectorholder:holder selector:addtocart];
                                         }
-
+                                        
                                     }
-
-
+                                    
+                                    
                                     DebugLog(@"No");
                                 }];
-                                [alertControl addAction:actionOne];
-
+                                //                                        [alertControl addAction:actionOne];
+                                
                                 [alertControl addAction:alertthree];
-
+                                
                                 UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                                 }];
                                 [alertControl addAction:alertcancel];
+                                
                                 //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
+                                
+                                
                                 [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-
+                                
+                                
+                                
+                                
+                                
                             }
                             else
                             {
-                                if(openPendingOrder)
-                                {
-                                    NSString* msg =@"";
-                                    if(appDelegate.contact_id.length>0)
-                                    {
-                                        msg = [msg stringByAppendingString:@"Customer:"];
-                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-
-                                    }
-
-                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                                    //block代码块取代了delegate
-
-
-
-                                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                                        //  vc.disable_refresh = true;
-                                        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
-                                        ovc.showNavibar = true;
-                                        ovc.customer_id = appDelegate.contact_id;
-                                        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
-
-                                            [holder performSelector:addtocart];
-
-
-                                        };
-                                        ovc.init_style = OL_OPEN;
-
-                                        ovc.onCancel = ^(){
-
-                                            //  self.disable_refresh = false;
-
-
-
-                                        };
-
-                                        [vc.navigationController pushViewController:ovc animated:true];
-
-
-
-
-
-                                    }];
-
-
-                                    [alertControl addAction:actionOne];
-                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                                    }];
-                                    [alertControl addAction:alertcancel];
-
-                                    //   [alertControl addAction:alertthree];
-
-                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
-                                    [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-
-
-                                }
-                                else if(createNewOrder)
-                                {
-                                    NSString* msg =@"";
-                                    if(appDelegate.contact_id.length>0)
-                                    {
-                                        msg = [msg stringByAppendingString:@"Customer:"];
-                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
-
-                                    }
-
-                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                                    //block代码块取代了delegate
-
-
-
-
-
-                                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-
-
-                                        {
-                                            //create new;
-                                            //    self.disable_refresh = true;
-                                            if(appDelegate.customerInfo==nil)// select contact if current contact not exist
-                                            {
-                                                ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
-                                                cvc.showNavibar = true;
-                                                cvc.contact_type = @"Sales_Order_Customer";
-                                                cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
-
-                                                    appDelegate.contact_id=[value valueForKey:@"customer_cid"];
-                                                    appDelegate.customerInfo = value;
-
-
-                                                    if(appDelegate.order_code==nil)
-                                                        [self neworder:vc selectorholder:holder selector:addtocart];
-                                                    //                                                            neworder();
-
-                                                    //    [main_vc checklogin:true];
-                                                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
-
-                                                    //
-                                                    //                if(self.returnValue)
-                                                    //                    self.returnValue(value);
-                                                };
-
-                                                cvc.onCancel = ^(){
-
-                                                    [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
-
-                                                    // self.disable_refresh = false;
-
-                                                };
-                                                cvc.onReset = ^(){
-                                                    // [main_vc checklogin:true];
-                                                };
-
-                                                [vc.navigationController pushViewController:cvc animated:true];
-                                            }
-                                            else
-                                            {
-                                                [self neworder:vc selectorholder:holder selector:addtocart];
-                                            }
-
-                                        }
-
-
-                                        DebugLog(@"No");
-                                    }];
-                                    //                                        [alertControl addAction:actionOne];
-
-                                    [alertControl addAction:alertthree];
-
-                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                                    }];
-                                    [alertControl addAction:alertcancel];
-
-                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-
-
-                                    [vc presentViewController:alertControl animated:YES completion:nil];
-
-
-
-
-
-                                }
-                                else
-                                {
-                                    [RAUtils message_alert:[return_json valueForKey:@"You donot have permission to access order"] title:@"Add To Cart" controller:vc];
-                                }
-
+                                [RAUtils message_alert:[return_json valueForKey:@"You donot have permission to access order"] title:@"Add To Cart" controller:vc];
                             }
-
-
-                        }
-                        else
-                        {
-
-                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
+                            
                         }
+                        
+                        
+                    }
+                    else
+                    {
+                        
+                        [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
+                    }
+                    
+                    
+                    
+                    
+                    
+                }];
 
-
-
-
-                    });
-                });
+//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//                    NSDictionary* return_json = [RANetwork request_PendingOrder:appDelegate.contact_id];
+//
+//                    dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                        [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//
+//                        if([[return_json valueForKey:@"result"] intValue]==2)
+//                        {
+//
+//                            bool openPendingOrder= [[return_json valueForKey:@"hasPending"] boolValue];
+//                            bool createNewOrder=appDelegate.can_create_order;
+//
+//                            if(openPendingOrder&&createNewOrder)
+//                            {
+//
+//                                NSString* msg =@"";
+//                                if(appDelegate.contact_id.length>0)
+//                                {
+//                                    msg = [msg stringByAppendingString:@"Customer:"];
+//                                    msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+//
+//                                }
+//
+//                                UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
+//                                //block代码块取代了delegate
+//
+//
+//
+//                                UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//
+//
+//                                    //  vc.disable_refresh = true;
+//                                    OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
+//                                    ovc.showNavibar = true;
+//                                    ovc.customer_id = appDelegate.contact_id;
+//                                    ovc.selectOrder = ^(NSMutableDictionary* order_detail){
+//
+//                                        [holder performSelector:addtocart];
+//
+//
+//                                    };
+//                                    ovc.init_style = OL_OPEN;
+//
+//                                    ovc.onCancel = ^(){
+//
+//                                        //  self.disable_refresh = false;
+//
+//
+//
+//                                    };
+//
+//                                    [vc.navigationController pushViewController:ovc animated:true];
+//
+//
+//
+//
+//
+//                                }];
+//
+//                                UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//
+//
+//                                    {
+//                                        //create new;
+//                                        //    self.disable_refresh = true;
+//                                        if(appDelegate.customerInfo==nil)// select contact if current contact not exist
+//                                        {
+//                                            ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
+//                                            cvc.showNavibar = true;
+//                                            cvc.contact_type = @"Sales_Order_Customer";
+//                                            cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
+//
+//                                                appDelegate.contact_id=[value valueForKey:@"customer_cid"];
+//                                                appDelegate.customerInfo = value;
+//
+//
+//                                                if(appDelegate.order_code==nil)
+//                                                    [self neworder:vc selectorholder:holder selector:addtocart];
+//                                                //                                                            neworder();
+//
+//                                                //    [main_vc checklogin:true];
+//                                                //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
+//
+//                                                //
+//                                                //                if(self.returnValue)
+//                                                //                    self.returnValue(value);
+//                                            };
+//
+//                                            cvc.onCancel = ^(){
+//
+//                                                [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
+//
+//                                                // self.disable_refresh = false;
+//
+//                                            };
+//                                            cvc.onReset = ^(){
+//                                                // [main_vc checklogin:true];
+//                                            };
+//
+//                                            [vc.navigationController pushViewController:cvc animated:true];
+//                                        }
+//                                        else
+//                                        {
+//                                            [self neworder:vc selectorholder:holder selector:addtocart];
+//                                        }
+//
+//                                    }
+//
+//
+//                                    DebugLog(@"No");
+//                                }];
+//                                [alertControl addAction:actionOne];
+//
+//                                [alertControl addAction:alertthree];
+//
+//                                UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//                                }];
+//                                [alertControl addAction:alertcancel];
+//                                //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+//
+//
+//                                [vc presentViewController:alertControl animated:YES completion:nil];
+//
+//
+//
+//
+//
+//
+//                            }
+//                            else
+//                            {
+//                                if(openPendingOrder)
+//                                {
+//                                    NSString* msg =@"";
+//                                    if(appDelegate.contact_id.length>0)
+//                                    {
+//                                        msg = [msg stringByAppendingString:@"Customer:"];
+//                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+//
+//                                    }
+//
+//                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
+//                                    //block代码块取代了delegate
+//
+//
+//
+//                                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//
+//
+//                                        //  vc.disable_refresh = true;
+//                                        OrderListViewController* ovc =[ [UIStoryboard storyboardWithName:@"ERP_Mobile_Order" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderListViewController"];
+//                                        ovc.showNavibar = true;
+//                                        ovc.customer_id = appDelegate.contact_id;
+//                                        ovc.selectOrder = ^(NSMutableDictionary* order_detail){
+//
+//                                            [holder performSelector:addtocart];
+//
+//
+//                                        };
+//                                        ovc.init_style = OL_OPEN;
+//
+//                                        ovc.onCancel = ^(){
+//
+//                                            //  self.disable_refresh = false;
+//
+//
+//
+//                                        };
+//
+//                                        [vc.navigationController pushViewController:ovc animated:true];
+//
+//
+//
+//
+//
+//                                    }];
+//
+//
+//                                    [alertControl addAction:actionOne];
+//                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//                                    }];
+//                                    [alertControl addAction:alertcancel];
+//
+//                                    //   [alertControl addAction:alertthree];
+//
+//                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+//
+//
+//                                    [vc presentViewController:alertControl animated:YES completion:nil];
+//
+//
+//
+//
+//
+//
+//
+//                                }
+//                                else if(createNewOrder)
+//                                {
+//                                    NSString* msg =@"";
+//                                    if(appDelegate.contact_id.length>0)
+//                                    {
+//                                        msg = [msg stringByAppendingString:@"Customer:"];
+//                                        msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
+//
+//                                    }
+//
+//                                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
+//                                    //block代码块取代了delegate
+//
+//
+//
+//
+//
+//                                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//
+//
+//                                        {
+//                                            //create new;
+//                                            //    self.disable_refresh = true;
+//                                            if(appDelegate.customerInfo==nil)// select contact if current contact not exist
+//                                            {
+//                                                ContactListViewController* cvc = [[UIStoryboard storyboardWithName:@"ERP_Mobile_Contact" bundle:nil] instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
+//                                                cvc.showNavibar = true;
+//                                                cvc.contact_type = @"Sales_Order_Customer";
+//                                                cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
+//
+//                                                    appDelegate.contact_id=[value valueForKey:@"customer_cid"];
+//                                                    appDelegate.customerInfo = value;
+//
+//
+//                                                    if(appDelegate.order_code==nil)
+//                                                        [self neworder:vc selectorholder:holder selector:addtocart];
+//                                                    //                                                            neworder();
+//
+//                                                    //    [main_vc checklogin:true];
+//                                                    //            [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
+//
+//                                                    //
+//                                                    //                if(self.returnValue)
+//                                                    //                    self.returnValue(value);
+//                                                };
+//
+//                                                cvc.onCancel = ^(){
+//
+//                                                    [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
+//
+//                                                    // self.disable_refresh = false;
+//
+//                                                };
+//                                                cvc.onReset = ^(){
+//                                                    // [main_vc checklogin:true];
+//                                                };
+//
+//                                                [vc.navigationController pushViewController:cvc animated:true];
+//                                            }
+//                                            else
+//                                            {
+//                                                [self neworder:vc selectorholder:holder selector:addtocart];
+//                                            }
+//
+//                                        }
+//
+//
+//                                        DebugLog(@"No");
+//                                    }];
+//                                    //                                        [alertControl addAction:actionOne];
+//
+//                                    [alertControl addAction:alertthree];
+//
+//                                    UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//                                    }];
+//                                    [alertControl addAction:alertcancel];
+//
+//                                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+//
+//
+//                                    [vc presentViewController:alertControl animated:YES completion:nil];
+//
+//
+//
+//
+//
+//                                }
+//                                else
+//                                {
+//                                    [RAUtils message_alert:[return_json valueForKey:@"You donot have permission to access order"] title:@"Add To Cart" controller:vc];
+//                                }
+//
+//                            }
+//
+//
+//                        }
+//                        else
+//                        {
+//
+//                            [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
+//                        }
+//
+//
+//
+//
+//                    });
+//                });
 
 
             }

+ 68 - 68
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -607,30 +607,30 @@
         }];
         return;
         
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            
-            NSDictionary* category=[RANetwork request_Cagegory];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                
-                if([[category valueForKey:@"result"] intValue]==2)
-                {
-                    appDelegate.categoryMenu = category;
-                }
-                else
-                {
-                    // [RAUtils error_alert:[category valueForKey:@"err_msg"] title:@"Failed to load category."] ;
-                }
-                
-                
-                
-                //            self.categoryViewController.categoryMenu = category;
-                
-                
-                
-            });
-        });
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//
+//            NSDictionary* category=[RANetwork request_Cagegory];
+//
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                if([[category valueForKey:@"result"] intValue]==2)
+//                {
+//                    appDelegate.categoryMenu = category;
+//                }
+//                else
+//                {
+//                    // [RAUtils error_alert:[category valueForKey:@"err_msg"] title:@"Failed to load category."] ;
+//                }
+//
+//
+//
+//                //            self.categoryViewController.categoryMenu = category;
+//
+//
+//
+//            });
+//        });
         
     }
     // Do any additional setup after loading the view, typically from a nib.
@@ -1000,24 +1000,24 @@
     }];
     return;
     
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        
-        NSDictionary* category=[RANetwork request_Cagegory];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            if([[category valueForKey:@"result"] intValue]==2)
-            {
-                appDelegate.categoryMenu = category;
-            }
-            else
-            {
-                //  [RAUtils error_alert:[category valueForKey:@"err_msg"]] ;
-            }
-            
-        });
-    });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//
+//        NSDictionary* category=[RANetwork request_Cagegory];
+//
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//
+//            if([[category valueForKey:@"result"] intValue]==2)
+//            {
+//                appDelegate.categoryMenu = category;
+//            }
+//            else
+//            {
+//                //  [RAUtils error_alert:[category valueForKey:@"err_msg"]] ;
+//            }
+//
+//        });
+//    });
     
 }
 - (IBAction)onUserButtonClick:(id)sender {
@@ -1583,32 +1583,32 @@
             }
         }];
         return;
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                   
-                   
-                   NSDictionary* category=[RANetwork request_Cagegory];
-                   
-                   dispatch_async(dispatch_get_main_queue(), ^{
-                       
-                       if([[category valueForKey:@"result"] intValue]==2)
-                       {
-                           appDelegate.categoryMenu = category;
-                           [categorymenuVC SetMenu:appDelegate.categoryMenu ];
-                       }
-                       else
-                           if([[category valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-                           {
-                               [categorymenuVC SetMenu:nil ];
-                           }
-                       else
-                       {
-                           [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
-                       }
-                       
-                       
-                       
-                   });
-               });
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//                   
+//                   
+//                   NSDictionary* category=[RANetwork request_Cagegory];
+//                   
+//                   dispatch_async(dispatch_get_main_queue(), ^{
+//                       
+//                       if([[category valueForKey:@"result"] intValue]==2)
+//                       {
+//                           appDelegate.categoryMenu = category;
+//                           [categorymenuVC SetMenu:appDelegate.categoryMenu ];
+//                       }
+//                       else
+//                           if([[category valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
+//                           {
+//                               [categorymenuVC SetMenu:nil ];
+//                           }
+//                       else
+//                       {
+//                           [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
+//                       }
+//                       
+//                       
+//                       
+//                   });
+//               });
     }
        
     else

+ 212 - 94
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -2146,46 +2146,85 @@
         {
             
             UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
-            dispatch_async(dispatch_get_global_queue(0,0), ^{
+            
+            [RANetwork request_notifymodel:productID emailAddr:nil withScreen:ScreenCodeCart completionHandler:^(NSMutableDictionary *result) {
+                NSMutableDictionary *dic = result;
                 
-                NSDictionary *dic = [RANetwork notifyModel:productID emailAddr:nil withScreen:ScreenCodeCart];
                 
-                dispatch_async(dispatch_get_main_queue(), ^{
+                [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
+                
+                int result_code = [[dic valueForKey:@"result"] intValue];
+                
+                if (result_code != RESULT_TRUE && result_code != RESULT_NO_EMAIL_ADDRESS)
+                {
                     
-                    [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
+                    NSString *msg = [NSString stringWithFormat:@"The email send failed"];
                     
-                    NSInteger result = [[dic valueForKey:@"result"] integerValue];
+                    if ([dic valueForKey:@"err_msg"]) {
+                        msg = [dic valueForKey:@"err_msg"];
+                    }
                     
-                    if (result != RESULT_TRUE && result != RESULT_NO_EMAIL_ADDRESS) {
-                        
-                        NSString *msg = [NSString stringWithFormat:@"The email send failed"];
-                        
-                        if ([dic valueForKey:@"err_msg"]) {
-                            msg = [dic valueForKey:@"err_msg"];
-                        }
-                        
-                        
-                        UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-                            
-                        }];
-                        
-                        [errorAlertVC addAction:action];
-                        [weakself presentViewController:errorAlertVC animated:YES completion:nil];
-                        
-                    } else if (result == RESULT_TRUE){
-                        
-                        [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
-                        
-                    } else if (result == RESULT_NO_EMAIL_ADDRESS) {
-                        
-                        [weakself showAddressBoxToEmailProduct:productID];
+                    
+                    UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
+                    UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                         
-                    }
-                });
-                
+                    }];
+                    
+                    [errorAlertVC addAction:action];
+                    [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+                    
+                } else if (result_code == RESULT_TRUE){
+                    
+                    [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
+                    
+                } else if (result_code == RESULT_NO_EMAIL_ADDRESS) {
+                    
+                    [weakself showAddressBoxToEmailProduct:productID];
+                    
+                }
                 
-            });
+            }];
+            
+//            dispatch_async(dispatch_get_global_queue(0,0), ^{
+//
+//                NSDictionary *dic = [RANetwork notifyModel:productID emailAddr:nil withScreen:ScreenCodeCart];
+//
+//                dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                    [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
+//
+//                    NSInteger result = [[dic valueForKey:@"result"] integerValue];
+//
+//                    if (result != RESULT_TRUE && result != RESULT_NO_EMAIL_ADDRESS) {
+//
+//                        NSString *msg = [NSString stringWithFormat:@"The email send failed"];
+//
+//                        if ([dic valueForKey:@"err_msg"]) {
+//                            msg = [dic valueForKey:@"err_msg"];
+//                        }
+//
+//
+//                        UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
+//                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//
+//                        }];
+//
+//                        [errorAlertVC addAction:action];
+//                        [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+//
+//                    } else if (result == RESULT_TRUE){
+//
+//                        [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
+//
+//                    } else if (result == RESULT_NO_EMAIL_ADDRESS) {
+//
+//                        [weakself showAddressBoxToEmailProduct:productID];
+//
+//                    }
+//                });
+//
+//
+//            });
             
             
         };
@@ -2604,11 +2643,10 @@
         
         UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Move To Back Order"];
         
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        [RANetwork request_movetobackorder:cart_item_id completionHandler:^(NSMutableDictionary *result) {
+           NSMutableDictionary* return_json =result  ;
             
-            NSDictionary* return_json = [RANetwork movetobackorder:cart_item_id];
             
-            dispatch_async(dispatch_get_main_queue(), ^{
                 
                 [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
                 
@@ -2621,9 +2659,29 @@
                     [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Move To Back Order" controller:self] ;
                 }
                 
-            }); // main
             
-        }); // global
+        }];
+        
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//            NSDictionary* return_json = [RANetwork movetobackorder:cart_item_id];
+//
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//
+//                if([[return_json valueForKey:@"result"] intValue]==2) {
+//
+//                    [self reload_data];
+//
+//                } // if 2
+//                else {
+//                    [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Move To Back Order" controller:self] ;
+//                }
+//
+//            }); // main
+//
+//        }); // global
         
         
     }];
@@ -3195,33 +3253,58 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
                 
                 UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
                 
-                dispatch_async(dispatch_get_global_queue(0, 0), ^{
-                   
-                    NSDictionary *result = [RANetwork quoteOrder:appDelegate.order_code emailAddr:text];
+                [RANetwork request_qouteorder:appDelegate.order_code emailAddr:text completionHandler:^(NSMutableDictionary *result) {
                     DebugLog(@"email cart result: %@",result);
-                   dispatch_async(dispatch_get_main_queue(), ^{
-                      
-                       [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
-                       
-                       if ([[result objectForKey:@"result"] integerValue] != RESULT_TRUE) {
-                           
-                           UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"The email send to %@ failed",text] preferredStyle:UIAlertControllerStyleAlert];
-                           UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-                               
-                           }];
-                           
-                           [errorAlertVC addAction:action];
-                           [weakself presentViewController:errorAlertVC animated:YES completion:nil];
-                           
-                       }else {
-                           
-                           [RAUtils message_alert:@"Send Email Success" title:@"Message" controller:weakself];
-                           
-                       }
-                       
-                   });
                     
-                });
+                    
+                    [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
+                    
+                    if ([[result objectForKey:@"result"] integerValue] != RESULT_TRUE) {
+                        
+                        UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"The email send to %@ failed",text] preferredStyle:UIAlertControllerStyleAlert];
+                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                            
+                        }];
+                        
+                        [errorAlertVC addAction:action];
+                        [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+                        
+                    }else {
+                        
+                        [RAUtils message_alert:@"Send Email Success" title:@"Message" controller:weakself];
+                        
+                    }
+                    
+                    
+                }];
+                
+//                dispatch_async(dispatch_get_global_queue(0, 0), ^{
+//
+//                    NSDictionary *result = [RANetwork quoteOrder:appDelegate.order_code emailAddr:text];
+//                    DebugLog(@"email cart result: %@",result);
+//                   dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                       [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
+//
+//                       if ([[result objectForKey:@"result"] integerValue] != RESULT_TRUE) {
+//
+//                           UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"The email send to %@ failed",text] preferredStyle:UIAlertControllerStyleAlert];
+//                           UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//
+//                           }];
+//
+//                           [errorAlertVC addAction:action];
+//                           [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+//
+//                       }else {
+//
+//                           [RAUtils message_alert:@"Send Email Success" title:@"Message" controller:weakself];
+//
+//                       }
+//
+//                   });
+//
+//                });
                 
             }];
             
@@ -3299,44 +3382,79 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
                 
                 UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
                 
-                dispatch_async(dispatch_get_global_queue(0, 0), ^{
+                [RANetwork request_notifymodel:productID emailAddr:text withScreen:ScreenCodeCart completionHandler:^(NSMutableDictionary *result) {
                     
-                    NSDictionary *result = [RANetwork notifyModel:productID emailAddr:text withScreen:ScreenCodeCart];
                     
-                    dispatch_async(dispatch_get_main_queue(), ^{
+                    [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
+                    
+                    int resultStatus = [[result objectForKey:@"result"] intValue];
+                    if (resultStatus != RESULT_TRUE && resultStatus != RESULT_NO_EMAIL_ADDRESS) {
                         
-                        [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
+                        NSString *msg = [NSString stringWithFormat:@"The email send failed"];
+                        if ([result valueForKey:@"err_msg"]) {
+                            msg = [result valueForKey:@"err_msg"];
+                        }
                         
-                        int resultStatus = [[result objectForKey:@"result"] intValue];
-                        if (resultStatus != RESULT_TRUE && resultStatus != RESULT_NO_EMAIL_ADDRESS) {
-                            
-                            NSString *msg = [NSString stringWithFormat:@"The email send failed"];
-                            if ([result valueForKey:@"err_msg"]) {
-                                    msg = [result valueForKey:@"err_msg"];
-                            }
-                            
-                            
-                            UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
-                            UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-                                
-                            }];
-                            
-                            [errorAlertVC addAction:action];
-                            [weakself presentViewController:errorAlertVC animated:YES completion:nil];
-                            
-                        }else if(resultStatus == RESULT_TRUE){
-                            
-                            [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
-                            
-                        } else if (resultStatus == RESULT_NO_EMAIL_ADDRESS) {
-                            
-                            [weakself showAddressBoxToEmailProduct:productID];
+                        
+                        UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
+                        UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                             
-                        }
+                        }];
+                        
+                        [errorAlertVC addAction:action];
+                        [weakself presentViewController:errorAlertVC animated:YES completion:nil];
                         
-                    });
+                    }else if(resultStatus == RESULT_TRUE){
+                        
+                        [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
+                        
+                    } else if (resultStatus == RESULT_NO_EMAIL_ADDRESS) {
+                        
+                        [weakself showAddressBoxToEmailProduct:productID];
+                        
+                    }
                     
-                });
+                    
+                }];
+                
+//                dispatch_async(dispatch_get_global_queue(0, 0), ^{
+//
+//                    NSDictionary *result = [RANetwork notifyModel:productID emailAddr:text withScreen:ScreenCodeCart];
+//
+//                    dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                        [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
+//
+//                        int resultStatus = [[result objectForKey:@"result"] intValue];
+//                        if (resultStatus != RESULT_TRUE && resultStatus != RESULT_NO_EMAIL_ADDRESS) {
+//
+//                            NSString *msg = [NSString stringWithFormat:@"The email send failed"];
+//                            if ([result valueForKey:@"err_msg"]) {
+//                                    msg = [result valueForKey:@"err_msg"];
+//                            }
+//
+//
+//                            UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
+//                            UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//
+//                            }];
+//
+//                            [errorAlertVC addAction:action];
+//                            [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+//
+//                        }else if(resultStatus == RESULT_TRUE){
+//
+//                            [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
+//
+//                        } else if (resultStatus == RESULT_NO_EMAIL_ADDRESS) {
+//
+//                            [weakself showAddressBoxToEmailProduct:productID];
+//
+//                        }
+//
+//                    });
+//
+//                });
                 
             }];
             

+ 98 - 98
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -1123,60 +1123,60 @@
         
         return;
         
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            NSDictionary* category_more=[RANetwork Category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip] ;
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                [self.mum stopAnimating];
-                self.isrefreshing=false;
-                if (self.dataOperationQueue.operationCount > 1) {
-                    return ;
-                }
-                
-                NSDictionary* more_items=[category_more objectForKey:@"items"];
-                if([[category_more valueForKey:@"result"] intValue]==2)
-                {
-                    //  self.category_data = category_data;
-                    NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-                    
-                    int count =[[more_items valueForKey:@"count"] intValue];
-                    for(int i=0;i<count;i++)
-                    {
-                        
-                        NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-                        [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-                        
-                        
-                    }
-                    long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
-                    [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
-                    [self.category_data setObject:items_json forKey:@"items"];
-                    self.offset+=count;
-                    
-                    if(count<20)
-                    {
-                        self.loadall=true;
-                        
-                    }
-                    //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-                    
-                    
-                    
-                    
-                    //   DebugLog(@"%@",self.category_data);
-                    
-                    [self.collectionview reloadData];
-                    
-                }
-                else
-                {
-                    [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Loading Category" controller:self] ;
-                }
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//            NSDictionary* category_more=[RANetwork Category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip] ;
+//
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//                [self.mum stopAnimating];
 //                self.isrefreshing=false;
-                
-            });
-        });
+//                if (self.dataOperationQueue.operationCount > 1) {
+//                    return ;
+//                }
+//
+//                NSDictionary* more_items=[category_more objectForKey:@"items"];
+//                if([[category_more valueForKey:@"result"] intValue]==2)
+//                {
+//                    //  self.category_data = category_data;
+//                    NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
+//
+//                    int count =[[more_items valueForKey:@"count"] intValue];
+//                    for(int i=0;i<count;i++)
+//                    {
+//
+//                        NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
+//                        [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
+//
+//
+//                    }
+//                    long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
+//                    [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
+//                    [self.category_data setObject:items_json forKey:@"items"];
+//                    self.offset+=count;
+//
+//                    if(count<20)
+//                    {
+//                        self.loadall=true;
+//
+//                    }
+//                    //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
+//
+//
+//
+//
+//                    //   DebugLog(@"%@",self.category_data);
+//
+//                    [self.collectionview reloadData];
+//
+//                }
+//                else
+//                {
+//                    [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Loading Category" controller:self] ;
+//                }
+////                self.isrefreshing=false;
+//
+//            });
+//        });
     });
 }
 
@@ -1271,51 +1271,51 @@
             
             return;
             
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                
-                NSDictionary* category_data=[RANetwork Category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:0 limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip];
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    
-                    [self.mum stopAnimating];
-                    self.isrefreshing=false;
-                    if (self.dataOperationQueue.operationCount > 1) {
-                        return ;
-                    }
-                    
-                    //                self.collectionview.userInteractionEnabled = true;
-                    self.category_data = [category_data mutableCopy];
-                    [self.collectionview reloadData];
-                    if([[category_data valueForKey:@"result"] intValue]==2)
-                    {
-                        
-                        self.collectionview.hidden=false;
-                        NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-                        self.offset =[[item_json valueForKey:@"count"] intValue];
-                        
-                        int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
-                        
-                        if(total<2)
-                            self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
-                        else
-                            self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
-                        
-                    }
-                    else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-                    {
-                        self.collectionview.hidden=true;
-                        self.label_net_err.hidden=false;
-                    }
-                    else
-                    {
-                        [RAUtils message_alert:[category_data valueForKey:@"err_msg"]  title:@"Loading Category" controller:self] ;
-                    }
-                    
-                    
-                    
-                    
-                });
-            });
+//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//                
+//                NSDictionary* category_data=[RANetwork Category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:0 limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip];
+//                
+//                dispatch_async(dispatch_get_main_queue(), ^{
+//                    
+//                    [self.mum stopAnimating];
+//                    self.isrefreshing=false;
+//                    if (self.dataOperationQueue.operationCount > 1) {
+//                        return ;
+//                    }
+//                    
+//                    //                self.collectionview.userInteractionEnabled = true;
+//                    self.category_data = [category_data mutableCopy];
+//                    [self.collectionview reloadData];
+//                    if([[category_data valueForKey:@"result"] intValue]==2)
+//                    {
+//                        
+//                        self.collectionview.hidden=false;
+//                        NSDictionary * item_json = [self.category_data objectForKey:@"items"];
+//                        self.offset =[[item_json valueForKey:@"count"] intValue];
+//                        
+//                        int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
+//                        
+//                        if(total<2)
+//                            self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
+//                        else
+//                            self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
+//                        
+//                    }
+//                    else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
+//                    {
+//                        self.collectionview.hidden=true;
+//                        self.label_net_err.hidden=false;
+//                    }
+//                    else
+//                    {
+//                        [RAUtils message_alert:[category_data valueForKey:@"err_msg"]  title:@"Loading Category" controller:self] ;
+//                    }
+//                    
+//                    
+//                    
+//                    
+//                });
+//            });
             
         });
     }

+ 141 - 141
RedAnt ERP Mobile/common/Functions/contact/ContactListViewController.m

@@ -355,73 +355,73 @@
         }];
         
         return;
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            
-            NSMutableDictionary* content=nil;
-            content=[[RANetwork request_ContactList:self.offset limit : self.limit keywords:self.keywords type:self.contact_type adv_search:self.adv_search] mutableCopy];
-            dispatch_async(dispatch_get_main_queue(), ^{
-                
-                [self.mum stopAnimating];
-                self.isrefreshing=false;
-                if (self.dataOperationQueue.operationCount > 1) {
-                    return ;
-                }
-                
-                
-                if([[content valueForKey:@"result"] intValue]==2)
-                {
-                    self.table.hidden =false;
-                    int count = [[content valueForKey:@"count" ] intValue] ;
-                    
-                    self.offset += count;
-                    for(int i=0;i<count;i++)
-                    {
-                        
-                        NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-                        [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-                        
-                    }
-                    if(count<self.limit)
-                    {
-                        
-                        //                    int i =self.btnrefresh.state;
-                        self.load_more_hint=@"All loaded";
-                        //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
-                        //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
-                    }
-                    else
-                    {
-                        self.load_more_hint=@"Load more...";
-                        //                    self.btnrefresh.enabled = true;
-                        //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
-                        //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
-                    }
-                    
-                    
-                    
-                    [self.table reloadData ];
-                    NSLog(@"%s reloadData",__FUNCTION__);
-                    
-                }
-                else if([[content valueForKey:@"result"] intValue]==RESULT_NET_ERROR &&self.offset==0)
-                {
-                    self.label_net_err.hidden=false;
-                    self.table.hidden = true;
-                }
-                else
-                {
-                    [RAUtils message_alert:[content valueForKey:@"err_msg"] title:@"Loading Contact List" controller:self] ;
-                }
-                
-                
-                
-                
-                
-                self.isrefreshing=false;
-                
-            });
-        });
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//
+//            NSMutableDictionary* content=nil;
+//            content=[[RANetwork request_ContactList:self.offset limit : self.limit keywords:self.keywords type:self.contact_type adv_search:self.adv_search] mutableCopy];
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                [self.mum stopAnimating];
+//                self.isrefreshing=false;
+//                if (self.dataOperationQueue.operationCount > 1) {
+//                    return ;
+//                }
+//
+//
+//                if([[content valueForKey:@"result"] intValue]==2)
+//                {
+//                    self.table.hidden =false;
+//                    int count = [[content valueForKey:@"count" ] intValue] ;
+//
+//                    self.offset += count;
+//                    for(int i=0;i<count;i++)
+//                    {
+//
+//                        NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
+//                        [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
+//
+//                    }
+//                    if(count<self.limit)
+//                    {
+//
+//                        //                    int i =self.btnrefresh.state;
+//                        self.load_more_hint=@"All loaded";
+//                        //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
+//                        //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
+//                    }
+//                    else
+//                    {
+//                        self.load_more_hint=@"Load more...";
+//                        //                    self.btnrefresh.enabled = true;
+//                        //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
+//                        //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+//                    }
+//
+//
+//
+//                    [self.table reloadData ];
+//                    NSLog(@"%s reloadData",__FUNCTION__);
+//
+//                }
+//                else if([[content valueForKey:@"result"] intValue]==RESULT_NET_ERROR &&self.offset==0)
+//                {
+//                    self.label_net_err.hidden=false;
+//                    self.table.hidden = true;
+//                }
+//                else
+//                {
+//                    [RAUtils message_alert:[content valueForKey:@"err_msg"] title:@"Loading Contact List" controller:self] ;
+//                }
+//
+//
+//
+//
+//
+//                self.isrefreshing=false;
+//
+//            });
+//        });
     });
 }
 
@@ -655,80 +655,80 @@
     
     return ;
     
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        NSDictionary* editor_json = [RANetwork request_CustomerInfo:contactid];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-            
-            if([[editor_json valueForKey:@"result"] intValue]==2)
-            {
-                __block NSMutableDictionary* data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
-                
-                //---------------- construct customer_contact----------------------
-                NSString* customer_first_name = [data_init valueForKey:@"customer_first_name"];
-                if(customer_first_name==nil)
-                    customer_first_name=@"";
-                
-                NSString* customer_last_name= [data_init valueForKey:@"customer_last_name"];
-                if(customer_last_name==nil)
-                    customer_last_name=@"";
-                NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
-                customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-                [data_init setValue:customer_contact forKey:@"customer_contact"];
-                
-                data_init[@"is_subaction"]=self.is_subaction;
-                data_init[@"subaction_tag"]= self.subaction_tag;
-                [self.navigationController popToRootViewControllerAnimated:false];
-                
-                
-                [self.table reloadData];
-                NSLog(@"%s reloadData",__FUNCTION__);
-                if(self.returnValue)
-                    self.returnValue(data_init,self.from);
-                
-                //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                //                    NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:data_init];
-                //
-                //                    dispatch_async(dispatch_get_main_queue(), ^{
-                //
-                //
-                //                        if([[editor_json valueForKey:@"result"] intValue]==2)
-                //                        {
-                //
-                ////                            [self.navigationController popViewControllerAnimated:false];
-                ////                            if(self.returnValue)
-                ////                            {
-                ////
-                ////                                self.returnValue(data_init);
-                ////                            }
-                //
-                //
-                //
-                //                        }
-                //                        else
-                //                        {
-                //                            [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
-                //                        }
-                //
-                //
-                //
-                //                    });
-                //                });
-                
-            }
-            else
-            {
-                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
-                //                self.btn_assign.enabled=false;
-            }
-            
-            
-        });
-    });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        NSDictionary* editor_json = [RANetwork request_CustomerInfo:contactid];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            
+//            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//            
+//            if([[editor_json valueForKey:@"result"] intValue]==2)
+//            {
+//                __block NSMutableDictionary* data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
+//                
+//                //---------------- construct customer_contact----------------------
+//                NSString* customer_first_name = [data_init valueForKey:@"customer_first_name"];
+//                if(customer_first_name==nil)
+//                    customer_first_name=@"";
+//                
+//                NSString* customer_last_name= [data_init valueForKey:@"customer_last_name"];
+//                if(customer_last_name==nil)
+//                    customer_last_name=@"";
+//                NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
+//                customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+//                [data_init setValue:customer_contact forKey:@"customer_contact"];
+//                
+//                data_init[@"is_subaction"]=self.is_subaction;
+//                data_init[@"subaction_tag"]= self.subaction_tag;
+//                [self.navigationController popToRootViewControllerAnimated:false];
+//                
+//                
+//                [self.table reloadData];
+//                NSLog(@"%s reloadData",__FUNCTION__);
+//                if(self.returnValue)
+//                    self.returnValue(data_init,self.from);
+//                
+//                //                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//                //                    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                //                    NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:data_init];
+//                //
+//                //                    dispatch_async(dispatch_get_main_queue(), ^{
+//                //
+//                //
+//                //                        if([[editor_json valueForKey:@"result"] intValue]==2)
+//                //                        {
+//                //
+//                ////                            [self.navigationController popViewControllerAnimated:false];
+//                ////                            if(self.returnValue)
+//                ////                            {
+//                ////
+//                ////                                self.returnValue(data_init);
+//                ////                            }
+//                //
+//                //
+//                //
+//                //                        }
+//                //                        else
+//                //                        {
+//                //                            [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
+//                //                        }
+//                //
+//                //
+//                //
+//                //                    });
+//                //                });
+//                
+//            }
+//            else
+//            {
+//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
+//                //                self.btn_assign.enabled=false;
+//            }
+//            
+//            
+//        });
+//    });
     
     
     

+ 25 - 25
RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.m

@@ -413,31 +413,31 @@
         
     }];
     return;
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        NSDictionary* editor_json = [RANetwork request_CustomerInfo:self.contactId];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-            
-            if([[editor_json valueForKey:@"result"] intValue]==2)
-            {
-                self.data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
-                
-                [self fillData];
-                self.btn_assign.enabled=true;
-                
-            }
-            else
-            {
-                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
-                self.btn_assign.enabled=false;
-            }
-            
-            
-        });
-    });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        NSDictionary* editor_json = [RANetwork request_CustomerInfo:self.contactId];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            
+//            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//            
+//            if([[editor_json valueForKey:@"result"] intValue]==2)
+//            {
+//                self.data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
+//                
+//                [self fillData];
+//                self.btn_assign.enabled=true;
+//                
+//            }
+//            else
+//            {
+//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
+//                self.btn_assign.enabled=false;
+//            }
+//            
+//            
+//        });
+//    });
 }
 - (void) fillData
 {

+ 45 - 45
RedAnt ERP Mobile/common/Functions/home/HomeViewController.m

@@ -133,52 +133,52 @@
             ;
         }];
         return;
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            
-            //debug
-//            NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"home_template" ofType:@"json" ]];
-//            NSError *error=nil;
-//            NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
 //            
-//            NSMutableDictionary* data=[jsobj mutableCopy];
-            NSMutableDictionary* data=[[RANetwork load_HomePage:0 customid:0] mutableCopy];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                
-                
-                [self.mum stopAnimating];
-                
-                self.content = data;
-                [self.homeTable reloadData];
-                self.homeTable.hidden=false;
-                if([[data valueForKey:@"result"] intValue]==2)
-                {
-                    DebugLog(@"HOMEVIEW JSON LOADED!");
-                    
-                    //debug
-                    //                NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"button_banner1" ofType:@"json" ]];
-                    //                NSError *error=nil;
-                    //                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
-                    //                [data setObject:jsobj forKey:@"view_3" ];
-                    
-                }
-                else
-                if([[data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-                {
-                    self.label_net_err.hidden=false;
-                }
-                else
-                {
-                    [RAUtils message_alert:[data valueForKey:@"err_msg"] title:@"Loading Home" controller:self] ;
-                }
-                
-                self.isrefreshing=false;
-                
-                
-                
-            });
-        });
+//            
+//            //debug
+////            NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"home_template" ofType:@"json" ]];
+////            NSError *error=nil;
+////            NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+////            
+////            NSMutableDictionary* data=[jsobj mutableCopy];
+//            NSMutableDictionary* data=[[RANetwork load_HomePage:0 customid:0] mutableCopy];
+//            
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//                
+//                
+//                [self.mum stopAnimating];
+//                
+//                self.content = data;
+//                [self.homeTable reloadData];
+//                self.homeTable.hidden=false;
+//                if([[data valueForKey:@"result"] intValue]==2)
+//                {
+//                    DebugLog(@"HOMEVIEW JSON LOADED!");
+//                    
+//                    //debug
+//                    //                NSData* json =[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"button_banner1" ofType:@"json" ]];
+//                    //                NSError *error=nil;
+//                    //                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//                    //                [data setObject:jsobj forKey:@"view_3" ];
+//                    
+//                }
+//                else
+//                if([[data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
+//                {
+//                    self.label_net_err.hidden=false;
+//                }
+//                else
+//                {
+//                    [RAUtils message_alert:[data valueForKey:@"err_msg"] title:@"Loading Home" controller:self] ;
+//                }
+//                
+//                self.isrefreshing=false;
+//                
+//                
+//                
+//            });
+//        });
     });
 }
 -(void) ReloadData

+ 62 - 62
RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m

@@ -96,68 +96,68 @@
 }
 - (IBAction)create_HangTag:(id)sender {
     
-    DetailViewController *vc= (DetailViewController *)[RAUtils getViewController:self];
-    
-    NSString *catelog_name = [NSString stringWithFormat:@"%@ Hang Tag",vc.groupName];
-    
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Processing"];
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        NSDictionary* editor_json = [RANetwork request_hangTag:vc.groupName];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-            
-            
-            if([[editor_json valueForKey:@"result"] intValue]==2)
-            {
-                
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                
-                NSString* url = [editor_json valueForKey:@"pdf_path"];
-                bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
-                RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
-                ViewController.url = url;
-                ViewController.canSave = false;
-                ViewController.isLocalfile=isLocalFile;
-                
-                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
-
-                
-                NSString* company=    [appDelegate.customerInfo valueForKey:@"customer_name"];
-                
-                if(company==nil)
-                    company=@"";
-                
-                NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
-                
-                
-                NSMutableArray* send_to = [[NSMutableArray alloc]init];
-                if(customer_email.length>0)
-                {
-                    send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
-                }
-                ViewController.mail_to = send_to;
-                
-                NSString* subject;
-                
-                subject =catelog_name;
-                
-                ViewController.mail_subject = subject;
-                
-                ViewController.hidenavi = false;
-                [vc.navigationController pushViewController:ViewController animated:YES];
-                
-            }
-            else
-            {
-                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Hang Tag" controller:vc];
-            }
-            
-        });
-    });
-    
-    
+//    DetailViewController *vc= (DetailViewController *)[RAUtils getViewController:self];
+//    
+//    NSString *catelog_name = [NSString stringWithFormat:@"%@ Hang Tag",vc.groupName];
+//    
+//    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Processing"];
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        NSDictionary* editor_json = [RANetwork request_hangTag:vc.groupName];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//            
+//            
+//            if([[editor_json valueForKey:@"result"] intValue]==2)
+//            {
+//                
+//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                
+//                NSString* url = [editor_json valueForKey:@"pdf_path"];
+//                bool isLocalFile = [[editor_json valueForKey:@"isLocalFile"] boolValue];
+//                RAPDFViewController *ViewController = [[UIStoryboard storyboardWithName:@"wkweb" bundle:nil] instantiateViewControllerWithIdentifier:@"RAPDFViewController"];
+//                ViewController.url = url;
+//                ViewController.canSave = false;
+//                ViewController.isLocalfile=isLocalFile;
+//                
+//                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
+//
+//                
+//                NSString* company=    [appDelegate.customerInfo valueForKey:@"customer_name"];
+//                
+//                if(company==nil)
+//                    company=@"";
+//                
+//                NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
+//                
+//                
+//                NSMutableArray* send_to = [[NSMutableArray alloc]init];
+//                if(customer_email.length>0)
+//                {
+//                    send_to=[[customer_email componentsSeparatedByString:NSLocalizedString(@";", nil)] mutableCopy];
+//                }
+//                ViewController.mail_to = send_to;
+//                
+//                NSString* subject;
+//                
+//                subject =catelog_name;
+//                
+//                ViewController.mail_subject = subject;
+//                
+//                ViewController.hidenavi = false;
+//                [vc.navigationController pushViewController:ViewController animated:YES];
+//                
+//            }
+//            else
+//            {
+//                [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Create Hang Tag" controller:vc];
+//            }
+//            
+//        });
+//    });
+//    
+//    
 }
 - (IBAction)add_toPortfolio:(id)sender {
     

Fichier diff supprimé car celui-ci est trop grand
+ 434 - 296
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m


+ 23 - 9
RedAnt ERP Mobile/common/Functions/offline/SelectUploadOrderViewController.m

@@ -205,17 +205,31 @@
         
         UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Merge Order"];
         
-        NSDictionary *ret = [RANetwork merge_order:params];
         
-        [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-        
-        [self.navigationController dismissViewControllerAnimated:YES completion:^{
-            
-            if (weakself.mergeBlock) {
-                weakself.mergeBlock(ret);
-            }
-            
+        [RANetwork request_mergeorder:params completionHandler:^(NSMutableDictionary *result) {
+             NSDictionary *ret = result;
+            [waitalert dismissWithClickedButtonIndex:0 animated:YES];
+                   
+                   [self.navigationController dismissViewControllerAnimated:YES completion:^{
+                       
+                       if (weakself.mergeBlock) {
+                           weakself.mergeBlock(ret);
+                       }
+                       
+                   }];
         }];
+        
+//        NSDictionary *ret = [RANetwork merge_order:params];
+//
+//        [waitalert dismissWithClickedButtonIndex:0 animated:YES];
+//
+//        [self.navigationController dismissViewControllerAnimated:YES completion:^{
+//
+//            if (weakself.mergeBlock) {
+//                weakself.mergeBlock(ret);
+//            }
+//
+//        }];
     }
     
     

+ 72 - 72
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioListViewController.m

@@ -227,78 +227,78 @@
         }];
         
         return;
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        
-        
-        
-        
-        NSMutableDictionary* content=nil;
-        content=[[RANetwork request_PDFList:self.offset limit : self.limit keywords:self.keywords] mutableCopy];
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            
-            
-            
-            
-            [self.mum stopAnimating];
-            
-            int result=[[content valueForKey:@"result"] intValue];
-            
-            if(result==2||result==0)
-            {
-                self.table.hidden =false;
-                
-                int count = [[content valueForKey:@"count" ] intValue] ;
-                
-                
-               // self.time_zone = [content valueForKey:@"time_zone" ];
-                self.offset += count;
-                for(int i=0;i<count;i++)
-                {
-                    
-                    NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-                    [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-                    DebugLog(@"content_data: %@",self.content_data);
-                }
-                if(count<self.limit)
-                {
-                    
-                    //                    int i =self.btnrefresh.state;
-                    self.load_more_hint=@"All loaded";
-                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
-                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
-                }
-                else
-                {
-                    self.load_more_hint=@"Load more...";
-                    //                    self.btnrefresh.enabled = true;
-                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
-                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
-                }
-                
-                
-                
-                [self.table reloadData ];
-            }
-            else if(result==RESULT_NET_ERROR)
-            {
-                self.label_net_err.hidden=false;
-                self.table.hidden=true;
-            }
-            else
-            {
-                [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Portfilio List" controller:self] ;
-            }
-            
-            
-           
-            self.isrefreshing=false;
-            
-            
-        });
-            
-        });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        
+//        
+//        
+//        
+//        NSMutableDictionary* content=nil;
+//        content=[[RANetwork request_PDFList:self.offset limit : self.limit keywords:self.keywords] mutableCopy];
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            
+//            
+//            
+//            
+//            
+//            [self.mum stopAnimating];
+//            
+//            int result=[[content valueForKey:@"result"] intValue];
+//            
+//            if(result==2||result==0)
+//            {
+//                self.table.hidden =false;
+//                
+//                int count = [[content valueForKey:@"count" ] intValue] ;
+//                
+//                
+//               // self.time_zone = [content valueForKey:@"time_zone" ];
+//                self.offset += count;
+//                for(int i=0;i<count;i++)
+//                {
+//                    
+//                    NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
+//                    [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
+//                    DebugLog(@"content_data: %@",self.content_data);
+//                }
+//                if(count<self.limit)
+//                {
+//                    
+//                    //                    int i =self.btnrefresh.state;
+//                    self.load_more_hint=@"All loaded";
+//                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
+//                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
+//                }
+//                else
+//                {
+//                    self.load_more_hint=@"Load more...";
+//                    //                    self.btnrefresh.enabled = true;
+//                    //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
+//                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+//                }
+//                
+//                
+//                
+//                [self.table reloadData ];
+//            }
+//            else if(result==RESULT_NET_ERROR)
+//            {
+//                self.label_net_err.hidden=false;
+//                self.table.hidden=true;
+//            }
+//            else
+//            {
+//                [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Portfilio List" controller:self] ;
+//            }
+//            
+//            
+//           
+//            self.isrefreshing=false;
+//            
+//            
+//        });
+//            
+//        });
     });
 }
 

+ 124 - 124
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -1247,99 +1247,99 @@
         
         return;
         
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-
-        
-        NSDictionary* category_more=[RANetwork Search:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull];
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [self.mum stopAnimating];
-            self.isrefreshing=false;
-            if (self.dataOperationQueue.operationCount > 1) {
-                return;
-            }
-            
-            NSDictionary* more_items=[category_more objectForKey:@"items"];
-            if([[category_more valueForKey:@"result"] intValue]==2)
-            {
-                //  self.category_data = category_data;
-                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-                
-                int count =[[more_items valueForKey:@"count"] intValue];
-                for(int i=0;i<count;i++)
-                {
-                    
-                    NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-                    
-                    
-                }
-                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
-                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
-                [self.category_data setObject:items_json forKey:@"items"];
-                self.offset+=count;
-                if(count<20)
-                {
-                    self.loadall=true;
-                    
-                }
-                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-                
-                
-                
-                
-        //        DebugLog(@"%@",self.category_data);
-                
-                [self.collectionview reloadData];
-                
-            }
-            else
-            {
-                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
-            }
-            self.isrefreshing=false;
-            
-        });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//
+//
+//        NSDictionary* category_more=[RANetwork Search:self.offset limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull];
 //        dispatch_async(dispatch_get_main_queue(), ^{
-//            //  self.category_data = category_data;
-//            
-//            
+//            [self.mum stopAnimating];
+//            self.isrefreshing=false;
+//            if (self.dataOperationQueue.operationCount > 1) {
+//                return;
+//            }
+//
+//            NSDictionary* more_items=[category_more objectForKey:@"items"];
 //            if([[category_more valueForKey:@"result"] intValue]==2)
 //            {
+//                //  self.category_data = category_data;
 //                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-//                
-//                int count =[[category_more valueForKey:@"count"] intValue];
+//
+//                int count =[[more_items valueForKey:@"count"] intValue];
 //                for(int i=0;i<count;i++)
 //                {
-//                    
-//                    NSDictionary * item_json = [category_more objectForKey:[NSString stringWithFormat:@"item_%d",i]];
+//
+//                    NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
 //                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-//                    
-//                    
+//
+//
 //                }
 //                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
 //                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
 //                [self.category_data setObject:items_json forKey:@"items"];
 //                self.offset+=count;
+//                if(count<20)
+//                {
+//                    self.loadall=true;
+//
+//                }
 //                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-//                
-//                
-//                
-//                
-//                DebugLog(@"%@",self.category_data);
-//                
+//
+//
+//
+//
+//        //        DebugLog(@"%@",self.category_data);
+//
 //                [self.collectionview reloadData];
+//
 //            }
 //            else
 //            {
-//                [RAUtils error_alert:[category_more valueForKey:@"err_msg"]] ;
+//                [RAUtils message_alert:[category_more valueForKey:@"err_msg"] title:@"Search" controller:self] ;
 //            }
-//            
-//            
+//            self.isrefreshing=false;
 //
-//            
 //        });
-    });
+////        dispatch_async(dispatch_get_main_queue(), ^{
+////            //  self.category_data = category_data;
+////
+////
+////            if([[category_more valueForKey:@"result"] intValue]==2)
+////            {
+////                NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
+////
+////                int count =[[category_more valueForKey:@"count"] intValue];
+////                for(int i=0;i<count;i++)
+////                {
+////
+////                    NSDictionary * item_json = [category_more objectForKey:[NSString stringWithFormat:@"item_%d",i]];
+////                    [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
+////
+////
+////                }
+////                long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
+////                [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
+////                [self.category_data setObject:items_json forKey:@"items"];
+////                self.offset+=count;
+////                //            NSDictionary * item_json = [self.category_data objectForKey:@"items"];
+////
+////
+////
+////
+////                DebugLog(@"%@",self.category_data);
+////
+////                [self.collectionview reloadData];
+////            }
+////            else
+////            {
+////                [RAUtils error_alert:[category_more valueForKey:@"err_msg"]] ;
+////            }
+////
+////
+////
+////
+////        });
+//    });
         });
 }
 
@@ -1432,57 +1432,57 @@
         
         return;
         
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        NSDictionary* category_data=[RANetwork Search:0 limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            [self.mum stopAnimating];
-            self.isrefreshing=false;
-            if (self.dataOperationQueue.operationCount > 1) {
-                return;
-            }
-            
-            self.category_data = [category_data mutableCopy];
-            [self.collectionview reloadData];
-            
-            if([[category_data valueForKey:@"result"] intValue]==2)
-            {
-                self.collectionview.hidden=false;
-                NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-                self.offset =[[item_json valueForKey:@"count"] intValue];
-                
-                int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
-                
-                if(total<2)
-                {
-                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
-                    if(total==1)
-                    {
-                        NSDictionary * detail_item = [item_json objectForKey:@"item_0"];
-                        NSString* detail_id=    [detail_item valueForKey:@"product_id"] ;
-                        
-                        [self showDetailat:detail_id category_id:nil name:[detail_item objectForKey:@"fash_name"] index:0];
-                    }
-                }
-                else
-                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
-            }
-            else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-            {
-                self.collectionview.hidden=true;
-                self.label_net_err.hidden=false;
-            }
-            else
-            {
-                [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
-            }
-            
-            self.isrefreshing=false;
-
-            });
-        });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        NSDictionary* category_data=[RANetwork Search:0 limit:20 keywords:self.keywords matchfull:self.loadmore_matchfull];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            
+//            [self.mum stopAnimating];
+//            self.isrefreshing=false;
+//            if (self.dataOperationQueue.operationCount > 1) {
+//                return;
+//            }
+//            
+//            self.category_data = [category_data mutableCopy];
+//            [self.collectionview reloadData];
+//            
+//            if([[category_data valueForKey:@"result"] intValue]==2)
+//            {
+//                self.collectionview.hidden=false;
+//                NSDictionary * item_json = [self.category_data objectForKey:@"items"];
+//                self.offset =[[item_json valueForKey:@"count"] intValue];
+//                
+//                int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
+//                
+//                if(total<2)
+//                {
+//                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d item",total];
+//                    if(total==1)
+//                    {
+//                        NSDictionary * detail_item = [item_json objectForKey:@"item_0"];
+//                        NSString* detail_id=    [detail_item valueForKey:@"product_id"] ;
+//                        
+//                        [self showDetailat:detail_id category_id:nil name:[detail_item objectForKey:@"fash_name"] index:0];
+//                    }
+//                }
+//                else
+//                    self.labelTotal.text = [NSString stringWithFormat:@"Total %d items",total];
+//            }
+//            else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
+//            {
+//                self.collectionview.hidden=true;
+//                self.label_net_err.hidden=false;
+//            }
+//            else
+//            {
+//                [RAUtils message_alert:[category_data valueForKey:@"err_msg"] title:@"Search" controller:self] ;
+//            }
+//            
+//            self.isrefreshing=false;
+//
+//            });
+//        });
     });
 }
 

+ 197 - 197
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -440,203 +440,203 @@
         
     }];
     return;
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        
-        int ret=[RANetwork  Authorize:user password:password];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-            self.btnLogin.enabled = true;
-            
-            if(ret==RESULT_TRUE)
-                
-            {
-               
-                //
-                //                NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                //                appDelegate.contact_id=contactid;
-                //                appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
-                
-                NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-                [defaults removeObjectForKey:@"user"];
-                [defaults removeObjectForKey:@"password"];
-                NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
-                NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
-                if(self.checkSavePassword.selected)
-                {
-                    
-                    [defaults setValue:encryptu forKey:@"user"];
-                    [defaults setValue:encryptp forKey:@"password"];
-                    sqlite3 *db = [iSalesDB get_db];
-                    
-                    int count =[iSalesDB get_recordcount:db table:@"login_info" where:[NSString stringWithFormat:@"name='%@'",encryptu]];
-                    
-                    if(count==0)
-                    {
-                        
-                        NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
-                        [iSalesDB execSql:savelogin db:db];
-                    }
-                    else
-                    {
-                        NSString * savelogin=[NSString stringWithFormat:@"update login_info set pwd='%@' where name='%@'",encryptp,encryptu];
-                        [iSalesDB execSql:savelogin db:db];
-                    }
-                    
-                    [iSalesDB close_db:db];
-                    
-                    //                    [defaults setBool:TRUE forKey:@"autologin"];
-                }
-                else
-                {
-                    NSString* sql=[NSString stringWithFormat:@"delete from login_info where name='%@'",encryptu];
-                    [iSalesDB execSql:sql];
-                }
-                [defaults synchronize];
-                
-                [self dismissViewControllerAnimated:YES completion:^{
-                    
-                    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-                    
-                    bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
-                    sqlite3* db = [iSalesDB get_db];
-                    int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
-                    
-                    [iSalesDB close_db:db];
-                    
-                    
-                    BOOL condition = offline_dirty && offline_user_exist>0;
-                    
-#ifdef OFFLINE_MODE
-                    condition = condition && !appDelegate.offline_mode;
-#endif
-                    if(condition)
-                    {
-                        
-                        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Detected new offline data" message:@"Do you want to sync with server?" preferredStyle:UIAlertControllerStyleAlert];
-                        //block代码块取代了delegate
-                        
-                        
-                        UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes(Recommended)" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-                            
-                            
-                            
-                            
-                            UIApplication * app = [UIApplication sharedApplication];
-                            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-                            //UIViewController* active_vc = appDelegate.active_controller;
-                            OfflineSettingViewController * offlineVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"OfflineSettingViewController"];
-                            //    loginvc.delegate = self;
-                            //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
-                            //       appDelegate.active_controller = gunVC;
-                            //        gunVC.onDismissVC = ^(){
-                            //            appDelegate.active_controller = active_vc;
-                            //        };
-                            UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:offlineVC] ;
-                            
-                            
-                            
-                            
-                            
-                            //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
-                            
-                            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-                            [appDelegate.main_vc presentViewController:navi animated:YES completion:^{
-                                
-                                
-                                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
-                                
-                                [main_vc checklogin:true];
-                                //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
-                                
-                                DebugLog(@"about present.........");
-                                
-                                //   self.btop = false;
-                                //  <#code#>
-                            }];
-                            
-                            
-                            
-                            
-                        }];
-                        
-                        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                            
-                            if(self.returnValue)
-                                self.returnValue(true);
-                            [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
-                            
-                        }];
-                        
-                        [alertControl addAction:actionTwo];
-                        [alertControl addAction:alertthree];
-                        
-                        
-                        
-                        [appDelegate.main_vc presentViewController:alertControl animated:YES completion:nil];
-                        
-                        
-                        
-                        
-                    }
-                    else
-                    {
-                    if(self.returnValue)
-                        self.returnValue(true);
-                    [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
-                    }
-                        }];
-
-
-                
-                //                if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
-                //                    [self.delegate LoginViewControllerDidLogin:self];
-                //                }
-                
-                [[NSNotificationCenter defaultCenter] postNotificationName:User_LoginOK_Notification object:nil];
-            }
-            else
-            {
-                NSString* msg=nil;
-                
-                switch (ret) {
-                        
-                    case RESULT_NET_NOTAVAILABLE:
-                        msg = MSG_NET_NOTAVAILABLE;
-                        break;
-                        
-                        
-                    case RESULT_NET_ERROR:
-                        msg = MSG_NET_ERROR;
-                        break;
-                        
-                        
-                    case RESULT_FALSE:
-                        msg = MSG_USERAUTH_ERROR;
-                        break;
-                        
-                    case RESULT_VER_LOW:
-                        msg = MSG_VER_LOW;
-                        break;
-                        
-                    case RESULT_LOGIN_DEVICE:
-                        msg= MSG_LOGIN_DEVICE;
-                        break;
-                    default:
-                        break;
-                }
-                
-                [RAUtils alert_view:msg title:@"Cannot sign-in"];
-                
-                
-                
-            }
-            
-            
-        });
-    });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        
+//        int ret=[RANetwork  Authorize:user password:password];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//            self.btnLogin.enabled = true;
+//            
+//            if(ret==RESULT_TRUE)
+//                
+//            {
+//               
+//                //
+//                //                NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
+//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                //                appDelegate.contact_id=contactid;
+//                //                appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
+//                
+//                NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+//                [defaults removeObjectForKey:@"user"];
+//                [defaults removeObjectForKey:@"password"];
+//                NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
+//                NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
+//                if(self.checkSavePassword.selected)
+//                {
+//                    
+//                    [defaults setValue:encryptu forKey:@"user"];
+//                    [defaults setValue:encryptp forKey:@"password"];
+//                    sqlite3 *db = [iSalesDB get_db];
+//                    
+//                    int count =[iSalesDB get_recordcount:db table:@"login_info" where:[NSString stringWithFormat:@"name='%@'",encryptu]];
+//                    
+//                    if(count==0)
+//                    {
+//                        
+//                        NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
+//                        [iSalesDB execSql:savelogin db:db];
+//                    }
+//                    else
+//                    {
+//                        NSString * savelogin=[NSString stringWithFormat:@"update login_info set pwd='%@' where name='%@'",encryptp,encryptu];
+//                        [iSalesDB execSql:savelogin db:db];
+//                    }
+//                    
+//                    [iSalesDB close_db:db];
+//                    
+//                    //                    [defaults setBool:TRUE forKey:@"autologin"];
+//                }
+//                else
+//                {
+//                    NSString* sql=[NSString stringWithFormat:@"delete from login_info where name='%@'",encryptu];
+//                    [iSalesDB execSql:sql];
+//                }
+//                [defaults synchronize];
+//                
+//                [self dismissViewControllerAnimated:YES completion:^{
+//                    
+//                    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+//                    
+//                    bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
+//                    sqlite3* db = [iSalesDB get_db];
+//                    int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
+//                    
+//                    [iSalesDB close_db:db];
+//                    
+//                    
+//                    BOOL condition = offline_dirty && offline_user_exist>0;
+//                    
+//#ifdef OFFLINE_MODE
+//                    condition = condition && !appDelegate.offline_mode;
+//#endif
+//                    if(condition)
+//                    {
+//                        
+//                        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Detected new offline data" message:@"Do you want to sync with server?" preferredStyle:UIAlertControllerStyleAlert];
+//                        //block代码块取代了delegate
+//                        
+//                        
+//                        UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes(Recommended)" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+//                            
+//                            
+//                            
+//                            
+//                            UIApplication * app = [UIApplication sharedApplication];
+//                            AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//                            //UIViewController* active_vc = appDelegate.active_controller;
+//                            OfflineSettingViewController * offlineVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"OfflineSettingViewController"];
+//                            //    loginvc.delegate = self;
+//                            //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
+//                            //       appDelegate.active_controller = gunVC;
+//                            //        gunVC.onDismissVC = ^(){
+//                            //            appDelegate.active_controller = active_vc;
+//                            //        };
+//                            UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:offlineVC] ;
+//                            
+//                            
+//                            
+//                            
+//                            
+//                            //    [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
+//                            
+//                            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+//                            [appDelegate.main_vc presentViewController:navi animated:YES completion:^{
+//                                
+//                                
+//                                    MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
+//                                
+//                                [main_vc checklogin:true];
+//                                //        navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
+//                                
+//                                DebugLog(@"about present.........");
+//                                
+//                                //   self.btop = false;
+//                                //  <#code#>
+//                            }];
+//                            
+//                            
+//                            
+//                            
+//                        }];
+//                        
+//                        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+//                            
+//                            if(self.returnValue)
+//                                self.returnValue(true);
+//                            [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
+//                            
+//                        }];
+//                        
+//                        [alertControl addAction:actionTwo];
+//                        [alertControl addAction:alertthree];
+//                        
+//                        
+//                        
+//                        [appDelegate.main_vc presentViewController:alertControl animated:YES completion:nil];
+//                        
+//                        
+//                        
+//                        
+//                    }
+//                    else
+//                    {
+//                    if(self.returnValue)
+//                        self.returnValue(true);
+//                    [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
+//                    }
+//                        }];
+//
+//
+//                
+//                //                if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
+//                //                    [self.delegate LoginViewControllerDidLogin:self];
+//                //                }
+//                
+//                [[NSNotificationCenter defaultCenter] postNotificationName:User_LoginOK_Notification object:nil];
+//            }
+//            else
+//            {
+//                NSString* msg=nil;
+//                
+//                switch (ret) {
+//                        
+//                    case RESULT_NET_NOTAVAILABLE:
+//                        msg = MSG_NET_NOTAVAILABLE;
+//                        break;
+//                        
+//                        
+//                    case RESULT_NET_ERROR:
+//                        msg = MSG_NET_ERROR;
+//                        break;
+//                        
+//                        
+//                    case RESULT_FALSE:
+//                        msg = MSG_USERAUTH_ERROR;
+//                        break;
+//                        
+//                    case RESULT_VER_LOW:
+//                        msg = MSG_VER_LOW;
+//                        break;
+//                        
+//                    case RESULT_LOGIN_DEVICE:
+//                        msg= MSG_LOGIN_DEVICE;
+//                        break;
+//                    default:
+//                        break;
+//                }
+//                
+//                [RAUtils alert_view:msg title:@"Cannot sign-in"];
+//                
+//                
+//                
+//            }
+//            
+//            
+//        });
+//    });
     
     
     

+ 70 - 44
RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m

@@ -574,44 +574,44 @@
         
         return;
         
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        NSDictionary* cart_json = [RANetwork request_WatchList:self.sortIndex];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            [self.mum stopAnimating];
-            self.isrefreshing=false;
-            if (self.dataOperationQueue.operationCount > 1) {
-                return ;
-            }
-            
-            int result=[[cart_json valueForKey:@"result"] intValue];
-            self.content_data = [cart_json mutableCopy];
-            [self.itemListTable reloadData];
-            self.print_url = [cart_json objectForKey:@"wishlist_print_url"];
-            
-            if(result==2||result==1||result==0)
-            {
-                self.itemListTable.hidden=false;
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                appDelegate.wish_count =[[self.content_data valueForKey:@"count"] intValue];
-            }
-            else
-                if(result==RESULT_NET_ERROR)
-                {
-                    self.label_net_err.hidden=false;
-                    self.itemListTable.hidden=true;
-                }
-            else
-            {
-                [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Loading Wish list" controller:self] ;
-            }
-            
-            self.isrefreshing=false;
-            
-        });
-    });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        NSDictionary* cart_json = [RANetwork request_WatchList:self.sortIndex];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            
+//            [self.mum stopAnimating];
+//            self.isrefreshing=false;
+//            if (self.dataOperationQueue.operationCount > 1) {
+//                return ;
+//            }
+//            
+//            int result=[[cart_json valueForKey:@"result"] intValue];
+//            self.content_data = [cart_json mutableCopy];
+//            [self.itemListTable reloadData];
+//            self.print_url = [cart_json objectForKey:@"wishlist_print_url"];
+//            
+//            if(result==2||result==1||result==0)
+//            {
+//                self.itemListTable.hidden=false;
+//                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//                appDelegate.wish_count =[[self.content_data valueForKey:@"count"] intValue];
+//            }
+//            else
+//                if(result==RESULT_NET_ERROR)
+//                {
+//                    self.label_net_err.hidden=false;
+//                    self.itemListTable.hidden=true;
+//                }
+//            else
+//            {
+//                [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Loading Wish list" controller:self] ;
+//            }
+//            
+//            self.isrefreshing=false;
+//            
+//        });
+//    });
         });
 }
 
@@ -1281,11 +1281,9 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
                 
                 UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
                 
-                dispatch_async(dispatch_get_global_queue(0, 0), ^{
-                    
-                    NSDictionary *result = [RANetwork quoteWishlist2EmailAddr:text];
+                [RANetwork request_emailwishlist:text completionHandler:^(NSMutableDictionary *result) {
                     DebugLog(@"email wishlist result: %@",result);
-                    dispatch_async(dispatch_get_main_queue(), ^{
+                    
                         
                         [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
                         
@@ -1305,9 +1303,37 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
                             
                         }
                         
-                    });
                     
-                });
+                }];
+                
+                
+//                dispatch_async(dispatch_get_global_queue(0, 0), ^{
+//
+//                    NSDictionary *result = [RANetwork quoteWishlist2EmailAddr:text];
+//                    DebugLog(@"email wishlist result: %@",result);
+//                    dispatch_async(dispatch_get_main_queue(), ^{
+//
+//                        [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
+//
+//                        if ([[result objectForKey:@"result"] integerValue] != RESULT_TRUE) {
+//
+//                            UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:[NSString stringWithFormat:@"The email send to %@ failed",text] preferredStyle:UIAlertControllerStyleAlert];
+//                            UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+//
+//                            }];
+//
+//                            [errorAlertVC addAction:action];
+//                            [weakself presentViewController:errorAlertVC animated:YES completion:nil];
+//
+//                        }else {
+//
+//                            [RAUtils message_alert:nil title:@"Email was sent successfully" controller:weakself];
+//
+//                        }
+//
+//                    });
+//
+//                });
                 
             }];
             

+ 26 - 26
RedAnt ERP Mobile/common/categoryMenu_RATree/RAViewController.m

@@ -397,31 +397,31 @@
     
     return;
     
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        
-        NSDictionary* category=[RANetwork request_Cagegory];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            if([[category valueForKey:@"result"] intValue]==2)
-            {
-                appDelegate.categoryMenu = category;
-                [self SetMenu:appDelegate.categoryMenu ];
-            }
-            else
-                if([[category valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
-                {
-                    [self SetMenu:nil ];
-                }
-                else
-                {
-                    [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
-                }
-            
-            
-            
-        });
-    });
+//    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//        
+//        
+//        NSDictionary* category=[RANetwork request_Cagegory];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            
+//            if([[category valueForKey:@"result"] intValue]==2)
+//            {
+//                appDelegate.categoryMenu = category;
+//                [self SetMenu:appDelegate.categoryMenu ];
+//            }
+//            else
+//                if([[category valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
+//                {
+//                    [self SetMenu:nil ];
+//                }
+//                else
+//                {
+//                    [RAUtils message_alert:[category valueForKey:@"err_msg"]  title:@"Load Category Menu" controller:self] ;
+//                }
+//            
+//            
+//            
+//        });
+//    });
 }
 @end

+ 32 - 25
RedAnt ERP Mobile/common/data_provider/RANetwork.h

@@ -54,16 +54,16 @@ extern NSString *const ScreenCodeOfflineSync;
 @interface RANetwork : NetworkUtils
 +(void) LoadImage:(NSString*) url into:(UIImageView*) container;
 +(NSDictionary*) portfolio_remove:(NSString* ) item_ids;
-+(NSDictionary*)request_Portfolio:(int)sort;
+//+(NSDictionary*)request_Portfolio:(int)sort;
 
 +(NSDictionary*) delete_portfoliolist:(NSString* ) listid;
 
 +(NSDictionary*) add_toPortfolio:(NSString* ) item_id withScreen:(NSString *)screenName;
 //+(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params;
-+(int)Authorize : (NSString*) user password:(NSString*) password ;
-+(NSDictionary*)logout;
-+(NSDictionary*)request_Cagegory;
-+(NSDictionary*)load_HomePage: (int) price_template customid:(int) customid;
+//+(int)Authorize : (NSString*) user password:(NSString*) password ;
+//+(NSDictionary*)logout;
+//+(NSDictionary*)request_Cagegory;
+//+(NSDictionary*)load_HomePage: (int) price_template customid:(int) customid;
 +(NSDictionary*)retrieve_password: (NSString*) user email:(NSString*) email;
 
 +(NSDictionary*)request_model_qty: (NSString*) fashionId;
@@ -71,14 +71,14 @@ extern NSString *const ScreenCodeOfflineSync;
 +(NSDictionary*)commoneditor_partialrefresh: (NSMutableDictionary*)params url:(NSString*)url;
 
 //+(NSDictionary*)Search: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword;
-+(NSDictionary*)Category: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip ;
+//+(NSDictionary*)Category: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip ;
 
-+(bool) IsNetworkAvailable;
+//+(bool) IsNetworkAvailable;
 +(int)parse_authinfo : (NSData *) json user:(NSString*) user password:(NSString*) password;
 
 
 
-+(NSDictionary*)request_ItemDetail: (NSString* ) item_id model_name:(NSString*) model_name category_id:(NSString*) category_id use_name :(bool) use_name groupName:(NSString *)groupName;
+//+(NSDictionary*)request_ItemDetail: (NSString* ) item_id model_name:(NSString*) model_name category_id:(NSString*) category_id use_name :(bool) use_name groupName:(NSString *)groupName;
 
 +(NSDictionary*) cart_incresement:(NSString*) cart_id increse:(bool) increse;
 +(NSDictionary*) cart_setQTY:(NSString*) cart_id value:(int) value;
@@ -97,7 +97,7 @@ extern NSString *const ScreenCodeOfflineSync;
 +(NSDictionary*) add_toCart_byName:(NSString* ) model_name withScreen:(NSString *)screenName;
 +(NSDictionary*) add_toWatchList:(NSString* ) item_id withScreen:(NSString *)screenName;
 +(NSDictionary*)request_Cart:(int)sort;
-+(NSDictionary*)request_WatchList:(int)sort;
+//+(NSDictionary*)request_WatchList:(int)sort;
 +(NSDictionary*) portfolio_setPrice:(NSString*) watchlist_id price:(float) price discount:(float) discount QTY:(int)qty qty_p:(float) qty_p notes:(NSString*)notes;
 //+(NSDictionary*) portfolio_setQTY:(NSString*) watchlist_id QTY:(int)qty;
 
@@ -108,7 +108,7 @@ extern NSString *const ScreenCodeOfflineSync;
 +(NSDictionary*) move_wish2cart:(NSString* ) item_ids;
 +(NSDictionary*) move_cart2wish:(NSString* ) item_ids;
 
-+(NSDictionary*)request_OrderList:(int ) offset limit :(int)limit keywords :(NSString* ) keywords status:(NSString*) status_code customer:(NSString*) customer is_merged:(BOOL) isMerged;
+//+(NSDictionary*)request_OrderList:(int ) offset limit :(int)limit keywords :(NSString* ) keywords status:(NSString*) status_code customer:(NSString*) customer is_merged:(BOOL) isMerged;
 +(NSDictionary*)request_OrderDetail:(NSMutableDictionary *) params;
 +(NSDictionary*)commit_Order:(NSString*) order_code;// saved:(bool) saved;
 +(NSDictionary*)copy_Order:(NSString*) order_code;
@@ -121,26 +121,26 @@ extern NSString *const ScreenCodeOfflineSync;
 +(NSDictionary*)save_Order:(NSMutableDictionary*)params;
 +(NSDictionary*)delete_Order:(NSString*) order_id;
 +(NSDictionary*)cancel_Order:(NSString*) order_id order_code:(NSString*) order_code;
-+(NSDictionary*)request_PendingOrder:(NSString* ) contactid;
-+(NSDictionary*)request_CustomerInfo:(NSString* ) contactid;
+//+(NSDictionary*)request_PendingOrder:(NSString* ) contactid;
+//+(NSDictionary*)request_CustomerInfo:(NSString* ) contactid;
 +(NSDictionary*)update_customer_img: (NSString*) contactid img_url:(NSString*) url ;
 //+(NSDictionary*) new_Customer;
 +(NSDictionary*)save_newCustomer:(NSMutableDictionary*)params;
 +(NSDictionary*)update_Customer:(NSMutableDictionary*)params;
 
 +(NSDictionary*)create_Address:(NSMutableDictionary*)params;
-+(NSDictionary*)request_ContactList:(int) offset limit:(int)limit keywords:(NSString*) keywords type:(NSString*) contact_type adv_search:(NSDictionary*)upparams;
+//+(NSDictionary*)request_ContactList:(int) offset limit:(int)limit keywords:(NSString*) keywords type:(NSString*) contact_type adv_search:(NSDictionary*)upparams;
 
 
-+(NSDictionary*)Search:(long ) offset limit :(long)limit keywords :(NSString*) keywords matchfull:(bool)matchfull;
+//+(NSDictionary*)Search:(long ) offset limit :(long)limit keywords :(NSString*) keywords matchfull:(bool)matchfull;
 +(NSDictionary*)ItemSearch:(long ) offset limit :(long)limit covertype:(NSString* ) covertype ctgid:(NSString*)ctgid modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller;
 
-+(NSDictionary*)request_Editor:(NSString*) request_url params:(NSMutableDictionary*)params;
+//+(NSDictionary*)request_Editor:(NSString*) request_url params:(NSMutableDictionary*)params;
 
 +(NSString*)DataTOjsonString:(id)object;
 
 
-+(NSDictionary*)request_PDFList:(int ) offset limit:(int)limit keywords:(NSString* ) keywords ;
+//+(NSDictionary*)request_PDFList:(int ) offset limit:(int)limit keywords:(NSString* ) keywords ;
 +(NSDictionary*)request_TearSheet:(NSMutableDictionary*)params;
 +(NSDictionary*)save_TearSheet:(NSMutableDictionary *)params;
 +(NSDictionary*)direct_save_TearSheet:(NSMutableDictionary*)params;//(NSString*) request_url name:(NSString*)name delete:(NSString* )ids note:(NSString* )saveNote modelIds:(NSDictionary *)modelIds;
@@ -173,19 +173,19 @@ extern NSString *const ScreenCodeOfflineSync;
 
 + (NSDictionary *)set_npd_shop_givenPrice:(NSMutableDictionary *)params;
 
-+ (NSDictionary *)merge_order:(NSMutableDictionary *)params;
+//+ (NSDictionary *)merge_order:(NSMutableDictionary *)params;
 
-+ (NSDictionary *)lock_order:(NSString *)oderCode;
+//+ (NSDictionary *)lock_order:(NSString *)oderCode;
 
-+ (NSDictionary *)quoteOrder:(NSString *)so_id emailAddr:(NSString *)addr;// email cart as quote
+//+ (NSDictionary *)quoteOrder:(NSString *)so_id emailAddr:(NSString *)addr;// email cart as quote
 
-+ (NSDictionary *)notifyModel:(NSString *)modelID emailAddr:(NSString *)addr withScreen:(NSString *)screenName;
+//+ (NSDictionary *)notifyModel:(NSString *)modelID emailAddr:(NSString *)addr withScreen:(NSString *)screenName;
 
-+ (NSDictionary *)quoteWishlist2EmailAddr:(NSString *)addr;
-
-+ (NSDictionary *)movetobackorder:(NSString *)cart_item_id;
-
-+ (NSDictionary*)request_hangTag:(NSString *)group;
+//+ (NSDictionary *)quoteWishlist2EmailAddr:(NSString *)addr;
+//
+//+ (NSDictionary *)movetobackorder:(NSString *)cart_item_id;
+//
+//+ (NSDictionary*)request_hangTag:(NSString *)group;
 
 
 #pragma mark 2020 new interface
@@ -207,4 +207,11 @@ extern NSString *const ScreenCodeOfflineSync;
 +(void)request_portfoliopdf:(int ) offset limit:(int)limit keywords:(NSString* ) keywords completionHandler:(resultHandler)result;
 +(void)request_orderlist:(int ) offset limit :(int)limit keywords :(NSString* ) keywords status:(NSString*) status_code customer:(NSString*) customer is_merged:(BOOL) isMerged completionHandler:(resultHandler)result;
 +(void)request_logout:(resultHandler)result;
++ (void)request_hangtag:(NSString *)group completionHandler:(resultHandler)result;
++ (void)request_movetobackorder:(NSString *)cart_item_id completionHandler:(resultHandler)result;
++ (void)request_emailwishlist:(NSString *)addr completionHandler:(resultHandler)result;
++(void)request_notifymodel:(NSString *)modelID emailAddr:(NSString *)addr withScreen:(NSString *)screenName completionHandler:(resultHandler)result;
++ (void)request_qouteorder:(NSString *)so_id emailAddr:(NSString *)addr completionHandler:(resultHandler)result;
++ (void)request_mergeorder:(NSMutableDictionary *)params completionHandler:(resultHandler)result;
++(void)request_pendingorder:(NSString *)contactid completionHandler:(resultHandler)result;
 @end

+ 502 - 47
RedAnt ERP Mobile/common/data_provider/RANetwork.m

@@ -4457,14 +4457,14 @@ repeat:
     return RESULT_USERAUTH_ERROR;
 }
 
-+(bool) IsNetworkAvailable
-{
-    
-    if (([Reachability reachabilityForInternetConnection].currentReachabilityStatus == NotReachable) &&
-        ([Reachability reachabilityForLocalWiFi].currentReachabilityStatus == NotReachable))
-        return false;
-    return true;
-}
+//+(bool) IsNetworkAvailable
+//{
+//    
+//    if (([Reachability reachabilityForInternetConnection].currentReachabilityStatus == NotReachable) &&
+//        ([Reachability reachabilityForLocalWiFi].currentReachabilityStatus == NotReachable))
+//        return false;
+//    return true;
+//}
 //+(NSString *)flattenHTML:(NSString *)html trimWhiteSpace:(BOOL)trim
 //{
 //    NSScanner *theScanner = [NSScanner scannerWithString:html];
@@ -4677,45 +4677,46 @@ repeat:
 
 }
 
-+ (NSDictionary *)lock_order:(NSString *)oderCode {
-    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
-    __block AppDelegate *appDelegate = nil;
-    
-    dispatch_sync(dispatch_get_main_queue(), ^{
-        //some UI methods ej
-        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
-    });
-    if(appDelegate.user!=nil)
-        [params setValue:appDelegate.user forKey:@"user"];
-
-    if(appDelegate.password!=nil)
-        [params setValue:appDelegate.password forKey:@"password"];
-    
-    [params setValue:oderCode forKey:@"orderCode"];
-
-    NSData* json=nil;
-    if(appDelegate.offline_mode)
-    {
-        json=[OLDataProvider offline_editorder:params];
-        
-    }
-    else
-    {
-        if(![self IsNetworkAvailable])
-            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
-        
-        json=[self get_json:URL_OPEN_ORDER parameters:params];
-    }
-    if(json!=nil)
-    {
-        NSError *error=nil;
-        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
-        
-        return jsobj;
-    }
-    else
-        return nil;
-}
+//+ (NSDictionary *)lock_order:(NSString *)oderCode
+//{
+//    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+//    __block AppDelegate *appDelegate = nil;
+//
+//    dispatch_sync(dispatch_get_main_queue(), ^{
+//        //some UI methods ej
+//        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    });
+//    if(appDelegate.user!=nil)
+//        [params setValue:appDelegate.user forKey:@"user"];
+//
+//    if(appDelegate.password!=nil)
+//        [params setValue:appDelegate.password forKey:@"password"];
+//
+//    [params setValue:oderCode forKey:@"orderCode"];
+//
+//    NSData* json=nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        json=[OLDataProvider offline_editorder:params];
+//
+//    }
+//    else
+//    {
+//        if(![self IsNetworkAvailable])
+//            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//        json=[self get_json:URL_OPEN_ORDER parameters:params];
+//    }
+//    if(json!=nil)
+//    {
+//        NSError *error=nil;
+//        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//
+//        return jsobj;
+//    }
+//    else
+//        return nil;
+//}
 
 + (NSDictionary *)quoteOrder:(NSString *)so_id emailAddr:(NSString *)addr {
     
@@ -6244,4 +6245,458 @@ repeat:
 //    }
 //    return jsobj;
 }
+
+
++ (void)request_hangtag:(NSString *)group completionHandler:(resultHandler)result
+{
+    
+#ifdef BUILD_UWAVER
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+     AppDelegate *appDelegate = nil;
+    
+    
+    appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+
+    if(appDelegate.user!=nil)
+        [params setValue:appDelegate.user forKey:@"user"];
+    if(appDelegate.contact_id!=nil)
+        [params setValue:appDelegate.contact_id forKey:@"contactId"];
+    if(appDelegate.password!=nil)
+        [params setValue:appDelegate.password forKey:@"password"];
+    
+    if (group) {
+        [params setValue:group forKey:@"groupName"];
+    }
+    NSString * uuid= [[NSUUID UUID] UUIDString];
+    params[@"resultSerial"]=uuid;
+    
+    [params setObject:ScreenCodeModelInfo forKey:kScreenName];
+    
+    
+    
+    if(appDelegate.offline_mode)
+    {
+
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSMutableDictionary* json = [[OLDataProvider offline_notimpl] mutableCopy];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(json);
+            });
+        });
+        
+        return;
+    }
+    
+    
+    [self request_interface:URL_CREATE_HANG_TAG parameters:params err_record_url:nil completionHandler:result retry:0];
+    
+//    NSData* json = nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        json = [OLDataProvider offline_portfolioList:params];
+//    } else {
+//        if(![self IsNetworkAvailable])
+//            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//        json = [self get_json:URL_CREATE_HANG_TAG parameters:params];
+//    }
+//
+//
+//    if(json==nil)
+//        return nil;
+//    NSError *error=nil;
+//    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//
+//    return jsobj;
+#else
+    return result(nil);
+#endif
+}
+
++ (void)request_movetobackorder:(NSString *)cart_item_id completionHandler:(resultHandler)result
+{
+    
+    if (cart_item_id == nil || cart_item_id.length < 1) {
+        result([@{@"result" : @(RESULT_FALSE),@"err_msg" : @"invalided product"} mutableCopy]);
+    }
+    
+    AppDelegate *appDelegate = nil;
+    
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+    NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
+    if(appDelegate.user!=nil)
+        [dic setValue:appDelegate.user forKey:@"user"];
+    
+    if(appDelegate.password!=nil)
+        [dic setValue:appDelegate.password forKey:@"password"];
+    
+    [dic setValue:cart_item_id forKey:@"orderitem_id"];
+    [dic setValue:appDelegate.order_code forKey:@"order_code"];
+    
+    [dic setObject:ScreenCodeCart forKey:kScreenName];
+    
+    
+        if(appDelegate.offline_mode)
+        {
+            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+                NSMutableDictionary* json = [[OLDataProvider offline_notimpl] mutableCopy];
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    result(json);
+                });
+            });
+            
+            return;
+        }
+        
+        
+        [self request_interface:URL_MOVE_TO_BACK_ORDER parameters:dic err_record_url:nil completionHandler:result retry:0];
+    
+    
+//    if(![self IsNetworkAvailable])
+//        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//    NSData *json = [RANetwork get_json:URL_MOVE_TO_BACK_ORDER parameters:dic];
+//
+//    if(json!=nil)
+//    {
+//        NSError *error=nil;
+//        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//
+//        return jsobj;
+//    }
+//
+//    return @{@"result" : @(RESULT_FALSE)};
+}
+
++ (void)request_emailwishlist:(NSString *)addr completionHandler:(resultHandler)result
+{
+    
+    NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
+         AppDelegate *appDelegate = nil;
+    
+
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.user!=nil)
+        [dic setValue:appDelegate.user forKey:@"user"];
+    
+    if(appDelegate.password!=nil)
+        [dic setValue:appDelegate.password forKey:@"password"];
+    
+    [dic setValue:addr forKey:@"email"];
+    
+    [dic setObject:ScreenCodeWishList forKey:kScreenName];
+    
+//    if (appDelegate.customerInfo) {
+//        NSString *customer_cid = [appDelegate.customerInfo objectForKey:@"customer_cid"];
+//        if (customer_cid) {
+//            [dic setValue:customer_cid forKey:@"contactId"];
+//        }
+//    }
+    
+    
+        if(appDelegate.offline_mode)
+        {
+
+            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+                NSMutableDictionary* json = [[OLDataProvider offline_notimpl] mutableCopy];
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    result(json);
+                });
+            });
+            
+            return;
+        }
+        
+        
+        [self request_interface:URL_EMAIL_WISHLIST parameters:dic err_record_url:nil completionHandler:result retry:0];
+    
+    
+    
+//    NSData* json=nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        return [OLDataProvider offline_notimpl];
+//    }
+//    else
+//    {
+//        if(![self IsNetworkAvailable])
+//            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//        json = [RANetwork get_json:URL_EMAIL_WISHLIST parameters:dic];
+//    }
+//    if(json!=nil)
+//    {
+//        NSError *error=nil;
+//        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//
+//
+//        return jsobj;
+//    }
+//
+//    return @{@"result" : @(RESULT_FALSE)};
+}
+
+
++(void)request_notifymodel:(NSString *)modelID emailAddr:(NSString *)addr withScreen:(NSString *)screenName completionHandler:(resultHandler)result
+{
+    
+    NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
+     AppDelegate *appDelegate = nil;
+    
+
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.user!=nil)
+        [dic setValue:appDelegate.user forKey:@"user"];
+    
+    if(appDelegate.password!=nil)
+        [dic setValue:appDelegate.password forKey:@"password"];
+    
+    if (appDelegate.user_type == USER_ROLE_EMPLOYEE && appDelegate.customerInfo) {
+        NSString *customer_cid = [appDelegate.customerInfo objectForKey:@"customer_cid"];
+        if (customer_cid) {
+            [dic setValue:customer_cid forKey:@"contactId"];
+        }
+    }
+    
+    [dic setObject:screenName forKey:kScreenName];
+    
+    [dic setValue:modelID forKey:@"productId"];
+    
+    if (addr) { // 弹框输入
+        [dic setValue:addr forKey:@"email"];
+    } else {
+        // employee选择了Contact,并且Contact有Email
+//        if (appDelegate.user_type == USER_ROLE_EMPLOYEE && appDelegate.customerInfo) {
+//            NSString *email = [appDelegate.customerInfo objectForKey:@"customer_email"];
+//            if (email) {
+//                [dic setValue:email forKey:@"email"];
+//            }
+//        }
+    }
+    
+    
+    
+    if(appDelegate.offline_mode)
+    {
+
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSMutableDictionary* json = [[OLDataProvider offline_notimpl] mutableCopy];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(json);
+            });
+        });
+        
+        return;
+    }
+    
+    
+    [self request_interface:URL_NOTIFY_ME parameters:dic err_record_url:nil completionHandler:result retry:0];
+    
+    
+//    NSData* json=nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        return [OLDataProvider offline_notimpl];
+//    }
+//    else
+//    {
+//        if(![self IsNetworkAvailable])
+//            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//        json = [RANetwork get_json:URL_NOTIFY_ME parameters:dic];
+//    }
+//    if(json!=nil)
+//    {
+//        NSError *error=nil;
+//        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//
+//
+//        return jsobj;
+//    }
+//
+//    return @{@"result" : @(RESULT_FALSE)};
+}
++ (void)request_qouteorder:(NSString *)so_id emailAddr:(NSString *)addr completionHandler:(resultHandler)result
+{
+    
+    NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
+     AppDelegate *appDelegate = nil;
+    
+
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+
+    if(appDelegate.user!=nil)
+        [dic setValue:appDelegate.user forKey:@"user"];
+    
+    if(appDelegate.password!=nil)
+        [dic setValue:appDelegate.password forKey:@"password"];
+    
+    [dic setValue:so_id forKey:@"orderCode"];
+    [dic setValue:addr forKey:@"email"];
+    
+    [dic setObject:ScreenCodeCart forKey:kScreenName];
+    
+    if (appDelegate.customerInfo) {
+        NSString *customer_cid = [appDelegate.customerInfo objectForKey:@"customer_cid"];
+        if (customer_cid) {
+            [dic setValue:customer_cid forKey:@"contactId"];
+        }
+    }
+    
+    
+    if(appDelegate.offline_mode)
+    {
+
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSMutableDictionary* json = [[OLDataProvider offline_notimpl] mutableCopy];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(json);
+            });
+        });
+        
+        return;
+    }
+    
+    
+    [self request_interface:URL_EMAIL_CART parameters:dic err_record_url:nil completionHandler:result retry:0];
+    
+//    NSData* json=nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        return [OLDataProvider offline_notimpl];
+//    }
+//    else
+//    {
+//        if(![self IsNetworkAvailable])
+//            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//        json = [RANetwork get_json:URL_EMAIL_CART parameters:dic];
+//    }
+//    if(json!=nil)
+//    {
+//        NSError *error=nil;
+//        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//
+//
+//        return jsobj;
+//    }
+//
+//    return @{@"result" : @(RESULT_FALSE)};
+}
++ (void)request_mergeorder:(NSMutableDictionary *)params completionHandler:(resultHandler)result
+{
+    
+    NSMutableDictionary* dic = [[NSMutableDictionary alloc] init];
+     AppDelegate *appDelegate = nil;
+    
+
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+  
+    if(appDelegate.user!=nil)
+        [dic setValue:appDelegate.user forKey:@"user"];
+
+    if(appDelegate.password!=nil)
+        [dic setValue:appDelegate.password forKey:@"password"];
+    
+    [dic setValue:[params objectForKey:@"order_ids"] forKey:@"order_ids"];
+    [dic setValue:[params objectForKey:@"targetOrderId"] forKey:@"targetOrderId"];
+    [dic setValue:[params objectForKey:@"customerInfo"] forKey:@"customerInfo"];
+    
+    [dic setObject:ScreenCodeOrderList forKey:kScreenName];
+    
+    
+    
+    if(appDelegate.offline_mode)
+    {
+
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSMutableDictionary* json = [[OLDataProvider offline_notimpl] mutableCopy];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(json);
+            });
+        });
+        
+        return;
+    }
+    
+    
+    [self request_interface:URL_SET_MERGE_ORDER parameters:dic err_record_url:nil completionHandler:result retry:0];
+    
+//    NSData* json=nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        return [OLDataProvider offline_notimpl];
+//    }
+//    else
+//    {
+//        if(![self IsNetworkAvailable])
+//            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//        json=[self get_json:URL_SET_MERGE_ORDER parameters:dic];
+//    }
+//    if(json!=nil)
+//    {
+//        NSError *error=nil;
+//        NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//
+//
+//        return jsobj;
+//    }
+//    else
+//        return nil;
+
+}
+
+
++(void)request_pendingorder:(NSString *)contactid completionHandler:(resultHandler)result
+{
+    
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+     AppDelegate *appDelegate = nil;
+    
+
+        appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
+
+    if(appDelegate.user!=nil)
+        [params setValue:appDelegate.user forKey:@"user"];
+    //    if(appDelegate.contact_id!=nil)
+    
+    if(appDelegate.password!=nil)
+        [params setValue:appDelegate.password forKey:@"password"];
+    [params setValue:contactid forKey:@"contactId"];
+    
+    if(appDelegate.offline_mode)
+    {
+
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            NSMutableDictionary* json = [[OLDataProvider offline_notimpl] mutableCopy];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                result(json);
+            });
+        });
+        
+        return;
+    }
+    
+    
+    [self request_interface:URL_CUSTOMER_PENDINGORDER parameters:params err_record_url:nil completionHandler:result retry:0];
+    
+//
+//    if(appDelegate.offline_mode)
+//    {
+//        return [OLDataProvider offline_notimpl];
+//    }
+//    if(![self IsNetworkAvailable])
+//        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//
+//    NSData* json=[self get_json:URL_CUSTOMER_PENDINGORDER parameters:params];
+//    if(json==nil)
+//        return nil;
+//    NSError *error=nil;
+//    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//    return jsobj;
+//
+}
 @end

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff