Parcourir la source

170105
common resource updated

Ray Zhang il y a 9 ans
Parent
commit
7172d25985

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


+ 2 - 2
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -330,7 +330,7 @@
                   moduleName = "NPD Mobile"
                   usesParentBreakpointCondition = "Yes"
                   urlString = "file:///ios_workspace/RedAnt%20ERP%20Mobile/common/Functions/order/CreateOrderViewController.m"
-                  timestampString = "505211419.128006"
+                  timestampString = "505295766.94078"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
                   startingLineNumber = "1157"
@@ -345,7 +345,7 @@
                   moduleName = "NPD Mobile"
                   usesParentBreakpointCondition = "Yes"
                   urlString = "file:///ios_workspace/RedAnt%20ERP%20Mobile/common/Functions/order/CreateOrderViewController.m"
-                  timestampString = "505211419.131019"
+                  timestampString = "505295766.943198"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
                   startingLineNumber = "1157"

+ 3 - 3
RedAnt ERP Mobile/common/CommonEditor/CommonEditor.storyboard

@@ -23,7 +23,7 @@
                         <subviews>
                             <datePicker contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" datePickerMode="dateAndTime" minuteInterval="1" translatesAutoresizingMaskIntoConstraints="NO" id="92Z-Po-m6V">
                                 <rect key="frame" x="0.0" y="73" width="768" height="292"/>
-                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                 <date key="date" timeIntervalSinceReferenceDate="427788188.02369201">
                                     <!--2014-07-23 06:03:08 +0000-->
                                 </date>
@@ -33,14 +33,14 @@
                             </datePicker>
                             <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cRS-hn-ulf">
                                 <rect key="frame" x="0.0" y="44" width="768" height="21"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pXA-kN-pBh">
                                 <rect key="frame" x="330" y="483" width="108" height="39"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="24"/>
                                 <state key="normal" title="Set"/>
                                 <connections>

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

@@ -163,7 +163,7 @@
         self.url = [pdfFolder stringByAppendingPathComponent:self.url];
         */
         self.content= [NSData dataWithContentsOfFile:self.url];
-        [self.webView loadData:self.content MIMEType:@"application/pdf" textEncodingName:nil baseURL:nil];
+        
         [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
         
         self.filename=[self.url lastPathComponent];
@@ -180,6 +180,9 @@
         if(self.autoPrint)
         [self startAirPrintWithData:self.content];
         
+        
+        [self.webView loadData:self.content MIMEType:@"application/pdf" textEncodingName:nil baseURL:nil];
+        
     }
     else
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

+ 2 - 2
RedAnt ERP Mobile/common/Functions/signature/signature.storyboard

@@ -58,7 +58,7 @@
                                         <rect key="frame" x="0.0" y="28" width="376" height="128"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pJ2-Li-nq4" id="hwz-Mn-MnM">
-                                            <rect key="frame" x="0.0" y="0.0" width="376" height="127.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="376" height="128"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <button hidden="YES" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="npR-Us-Ywj">
@@ -90,7 +90,6 @@
                     </view>
                     <toolbarItems/>
                     <navigationItem key="navigationItem" title="Title" id="XAK-aB-GtR">
-                        <barButtonItem key="leftBarButtonItem" systemItem="edit" id="UZx-65-lBp"/>
                         <barButtonItem key="rightBarButtonItem" systemItem="add" id="g6c-9y-EiG">
                             <connections>
                                 <action selector="onAddClick:" destination="xQW-5p-fJu" id="Xap-cW-ksy"/>
@@ -102,6 +101,7 @@
                     <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
                     <size key="freeformSize" width="376" height="640"/>
                     <connections>
+                        <outlet property="bbAdd" destination="g6c-9y-EiG" id="a8d-Wu-tz6"/>
                         <outlet property="tableView" destination="p4w-Uo-pFK" id="Lew-Ky-xNN"/>
                     </connections>
                 </viewController>

+ 1 - 1
RedAnt ERP Mobile/common/NetworkUtils.h

@@ -13,6 +13,6 @@ typedef NSMutableDictionary*(^decryptBlock)(NSMutableDictionary* result);
 
 @interface NetworkUtils : NSObject
 +(bool) IsNetworkAvailable;
-+(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params err_recorder:(NSString* )recorder_url result_handler:(resultBlock)resultBlock decrypt_handler:(decryptBlock)decryptBlock;
++(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params file:(NSString*)file_path err_recorder:(NSString* )recorder_url result_handler:(resultBlock)resultBlock decrypt_handler:(decryptBlock)decryptBlock;
 +(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code;
 @end

+ 10 - 5
RedAnt ERP Mobile/common/NetworkUtils.m

@@ -34,7 +34,7 @@
     return true;
 }
 
-+(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params err_recorder:(NSString* )recorder_url result_handler:(resultBlock)resultBlock decrypt_handler:(decryptBlock)decryptBlock
++(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params file:(NSString*)file_path err_recorder:(NSString* )recorder_url result_handler:(resultBlock)resultBlock decrypt_handler:(decryptBlock)decryptBlock
 {
     int retry = 0;
     
@@ -60,7 +60,7 @@ repeat:
         //要上传的图片
         //    UIImage *image=[params objectForKey:@"pic"];
         //得到图片的data
-        //    NSData* data = UIImagePNGRepresentation(image);
+            NSData* data = [NSData dataWithContentsOfFile:file_path];
         //http body的字符串
         NSMutableString *body=[[NSMutableString alloc]init];
         
@@ -100,9 +100,14 @@ repeat:
         ////添加分界线,换行
         [body appendFormat:@"%@\r\n",MPboundary];
         //声明pic字段,文件名为boris.png
-        [body appendFormat:@"Content-Disposition: form-data; name=\"pic\"; filename=\"boris.png\"\r\n"];
+        
+        NSString * file_format=[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upfile\"; filename=\"%@\"\r\n", [file_path lastPathComponent]];
+
+        
+        
+        [body appendFormat:@"%@", file_format];
         //声明上传文件的格式
-        [body appendFormat:@"Content-Type: image/png\r\n\r\n"];
+        [body appendFormat:@"Content-Type: application/zip\r\n\r\n"];
         
         //声明结束符:--AaB03x--
         NSString *end=[[NSString alloc]initWithFormat:@"\r\n%@",endMPboundary];
@@ -111,7 +116,7 @@ repeat:
         //将body字符串转化为UTF8格式的二进制
         [myRequestData appendData:[body dataUsingEncoding:NSUTF8StringEncoding]];
         //将image的data加入
-        //    [myRequestData appendData:data];
+            [myRequestData appendData:data];
         //加入结束符--AaB03x--
         [myRequestData appendData:[end dataUsingEncoding:NSUTF8StringEncoding]];
         

+ 1 - 1
RedAnt ERP Mobile/common/PDFUtils.h

@@ -9,7 +9,7 @@
 #import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
 @interface PDFUtils : NSObject
-+(NSString*) addSignature :(UIImage*) img to:(NSMutableDictionary*)signatureData;
++(NSString*) addSignature :(UIImage*) img to:(NSMutableDictionary*)signatureData subType:(NSString*)subtype;
 +(NSString *) saveTempSignature:(NSData *) image;
 +(CGPDFDocumentRef)OpenPDF:(NSString*) file;
 

+ 17 - 7
RedAnt ERP Mobile/common/PDFUtils.m

@@ -14,7 +14,7 @@
 
 
 @implementation PDFUtils
-+(NSString*) addSignature :(UIImage*) img to:(NSMutableDictionary*)signatureData
++(NSString*) addSignature :(UIImage*) img to:(NSMutableDictionary*)signatureData subType:(NSString*)subtype
 {
     
     
@@ -22,14 +22,20 @@
     {
         NSString* newfile=[self saveTempSignature:UIImagePNGRepresentation(img)];
         
-        int newidx = [signatureData[@"count"] intValue];
+        int newidx = [signatureData[subtype][@"count"] intValue];
         
         // [@"file"]= newfile;
         
         NSMutableDictionary* item = [[NSMutableDictionary alloc] init];
         item[@"file"]=newfile;
-        signatureData[[NSString stringWithFormat:@"item_%d",newidx]] = item;
-        signatureData[@"count"]=[NSNumber numberWithInt:newidx+1];
+        
+        NSMutableDictionary* subjson =signatureData[subtype];
+        if(subjson==nil)
+            subjson = [[NSMutableDictionary alloc] init];
+        subjson[[NSString stringWithFormat:@"item_%d",newidx]] = item;
+        subjson[@"count"]=[NSNumber numberWithInt:newidx+1];
+        
+        signatureData[subtype]=subjson;
         
         return newfile;
         
@@ -226,14 +232,17 @@
     [NSDictionary dictionaryWithObjectsAndKeys:
      @"usai2010", (NSString *)kCGPDFContextOwnerPassword,
      kCFBooleanTrue, (NSString *)kCGPDFContextAllowsPrinting,
-     kCFBooleanTrue, (NSString *)kCGPDFContextAllowsCopying,
+     kCFBooleanFalse, (NSString *)kCGPDFContextAllowsCopying,
      nil];
     // Create a descriptor.
-    CFDictionaryRef cfpdfAttributes =(__bridge CFDictionaryRef)PDFAttributes;
+ CFDictionaryRef cfpdfAttributes =(__bridge CFDictionaryRef)(PDFAttributes);
 
     
+   // CFBridgingRelease(cfpdfAttributes);
+    pdfContext=CGPDFContextCreateWithURL(url, &docsize,cfpdfAttributes);
+    
+    
     
-    pdfContext=CGPDFContextCreateWithURL(url, &docsize, cfpdfAttributes);
     size_t page_count=CGPDFDocumentGetNumberOfPages(document);
     for(int i=1;i<=page_count;i++)
     {
@@ -342,6 +351,7 @@
     }
     CGContextRelease(pdfContext);
     CFBridgingRelease(url);
+  //  CFRelease(cfpdfAttributes);
 //    //开始画pdf
 //    
 //    //    NSString *temtext=[[NSString alloc]init];