Explorar o código

2.修改PDF本地数据加载时修改文件名。

Pen Li %!s(int64=8) %!d(string=hai) anos
pai
achega
1056ad4b0e

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


+ 15 - 1
RedAnt ERP Mobile/common/Functions/PDF+Web/PDFViewController.m

@@ -191,6 +191,16 @@
 
 
     
     
 }
 }
+
+- (void)copyTmpLocalFile:(NSString *)localPath {
+    
+    NSString *path = NSTemporaryDirectory();
+    NSString *filePath = [path stringByAppendingPathComponent:self.filename];
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    [fileManager copyItemAtPath:localPath toPath:filePath error:nil];
+    self.url = filePath;
+}
+
 -(void) loadcontent
 -(void) loadcontent
 {
 {
     
     
@@ -210,7 +220,11 @@
         
         
         [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
         [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
         
         
-        self.filename=[self.url lastPathComponent];
+        if (self.filename.length <= 0) {
+            self.filename=[self.url lastPathComponent];
+        } else {
+            [self copyTmpLocalFile:self.url];
+        }
         
         
         self.btnshare.enabled =true;
         self.btnshare.enabled =true;
         
         

+ 3 - 4
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -52,8 +52,7 @@
     ViewController.isLocalfile=YES;
     ViewController.isLocalfile=YES;
     NSString* subject;
     NSString* subject;
     
     
-    NSString* cur_time =[RAUtils current_date];
-    subject =@"Sales Order";
+    subject =[NSString stringWithFormat:@"Sales Order %@",self.order_code];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
     NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
     
     
@@ -66,7 +65,7 @@
     }
     }
     ViewController.mail_to = send_to;
     ViewController.mail_to = send_to;
 
 
-    ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
+    ViewController.filename = [NSString stringWithFormat:@"%@.pdf",self.order_code];
     ViewController.mail_subject = subject;
     ViewController.mail_subject = subject;
     
     
     ViewController.hidenavi = false;
     ViewController.hidenavi = false;
@@ -440,7 +439,6 @@
         
         
         ViewController.url = url;
         ViewController.url = url;
         
         
-        
         [self.navigationController pushViewController:ViewController animated:YES];
         [self.navigationController pushViewController:ViewController animated:YES];
         }
         }
         
         
@@ -480,6 +478,7 @@
             NSString* url=[self.content_data valueForKey:@"pdfUrl"];
             NSString* url=[self.content_data valueForKey:@"pdfUrl"];
             DebugLog(@"pdf url:%@",url);
             DebugLog(@"pdf url:%@",url);
             ViewController.url = url;
             ViewController.url = url;
+            
             [self.navigationController pushViewController:ViewController animated:YES];
             [self.navigationController pushViewController:ViewController animated:YES];
         }
         }