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

修改Notify Me,选择Customer时提交参数增加Customer ID。

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

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


+ 52 - 48
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -968,6 +968,55 @@ self.isrefreshing=false;
             cell.btnNotifyMe.layer.cornerRadius = 3.0f;
             cell.btnNotifyMe.layer.masksToBounds = YES;
             
+            __weak typeof(self) weakself = self;
+            cell.notifyMeBlock = ^{
+                
+                UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
+                dispatch_async(dispatch_get_global_queue(0,0), ^{
+                    
+                    NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
+                    
+                    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:@"result"] integerValue] == 8) {
+                                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) {
+                            
+                            [self showEmailAddrBox];
+                            
+                        }
+                    });
+                    
+                    
+                });
+                
+                
+            };
+            
+            
             if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
                 
                 cell.btnaddPortfolio.hidden = YES;
@@ -980,53 +1029,7 @@ self.isrefreshing=false;
                     
                     
                     cell.btnNotifyMe.hidden = NO;
-                    __weak typeof(self) weakself = self;
-                    cell.notifyMeBlock = ^{
-                        
-                        UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
-                        dispatch_async(dispatch_get_global_queue(0,0), ^{
-                            
-                            NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
-                            
-                            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:@"result"] integerValue] == 8) {
-                                        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) {
-                                    
-                                    [self showEmailAddrBox];
-                                    
-                                }
-                            });
-                            
-                            
-                        });
-                        
-                        
-                    };
+                    
                     
                     if (!appDelegate.order_code) { // 未打开订单状态
                         
@@ -1081,6 +1084,7 @@ self.isrefreshing=false;
                 
             } else { // employee
                 
+                // online
                 cell.btnaddPortfolio.hidden = NO;
                 cell.btnNotifyMe.hidden = NO;
                 
@@ -1094,8 +1098,8 @@ self.isrefreshing=false;
                     cell.btnaddCart.enabled = YES;
                 }
                 
+                // offline
                 if (appDelegate.offline_mode) {
-                    
                     cell.btnNotifyMe.hidden = YES;
                 }
                 

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

@@ -11598,7 +11598,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     
     if ([retDic[@"result"] integerValue] == RESULT_TRUE) {
         
-        int ret = [[[self offline_deletewishlist:@{@"collectId" : [delete_collectId componentsJoinedByString:@","]}.mutableCopy] valueForKey:@"result"] integerValue];
+        NSInteger ret = [[[self offline_deletewishlist:@{@"collectId" : [delete_collectId componentsJoinedByString:@","]}.mutableCopy] valueForKey:@"result"] integerValue];
         
         retDic[@"result"] = [NSNumber numberWithInteger:ret];
         

+ 10 - 0
RedAnt ERP Mobile/common/data_provider/iSalesNetwork.m

@@ -3966,11 +3966,21 @@ repeat:
     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 setValue:modelID forKey:@"productId"];
+    
     if (addr) {
         [dic setValue:addr forKey:@"email"];
     }
     
+    
+    
     NSData* json=nil;
     if(appDelegate.offline_mode)
     {