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

160926
Add: sync log add attachment: local db.

Ray Zhang 9 лет назад
Родитель
Сommit
63cc9396fc

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


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

@@ -20,11 +20,11 @@
             ignoreCount = "0"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             continueAfterRunningActions = "No"
             filePath = "common/Functions/offline/SyncControlPanelViewController.m"
             filePath = "common/Functions/offline/SyncControlPanelViewController.m"
-            timestampString = "496549082.172198"
+            timestampString = "496568900.003115"
             startingColumnNumber = "9223372036854775807"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "129"
-            endingLineNumber = "129"
+            startingLineNumber = "134"
+            endingLineNumber = "134"
             landmarkName = "-onSendlogClick:"
             landmarkName = "-onSendlogClick:"
             landmarkType = "7">
             landmarkType = "7">
          </BreakpointContent>
          </BreakpointContent>
@@ -157,5 +157,37 @@
             landmarkType = "7">
             landmarkType = "7">
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/CommonEditor/CommonEditorViewController.m"
+            timestampString = "496566742.834628"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "5930"
+            endingLineNumber = "5930"
+            landmarkName = "-switchIsChanged:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/CommonEditor/CommonEditorViewController.m"
+            timestampString = "496567529.953271"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "6003"
+            endingLineNumber = "6003"
+            landmarkName = "-switchIsChanged:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
    </Breakpoints>
 </Bucket>
 </Bucket>

+ 1 - 0
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.h

@@ -50,6 +50,7 @@
 @property int ioffset;
 @property int ioffset;
 @property int keyboard_h;
 @property int keyboard_h;
 @property (strong,nonatomic) NSMutableDictionary* requried;
 @property (strong,nonatomic) NSMutableDictionary* requried;
+//@property (strong,nonatomic) NSLock *switchlock ;
 
 
 @property (strong,nonatomic) NSIndexPath* first_miss_pos;
 @property (strong,nonatomic) NSIndexPath* first_miss_pos;
 
 

+ 17 - 2
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -223,6 +223,12 @@
 - (void)viewDidLoad
 - (void)viewDidLoad
 {
 {
     [super viewDidLoad];
     [super viewDidLoad];
+ 
+    
+//    self.switchlock =  [[NSLock alloc] init];
+    
+    
+//    [self.editorTable setExclusiveTouch:false];
     
     
     self.editable = NO;
     self.editable = NO;
     
     
@@ -5919,12 +5925,19 @@
 
 
 #pragma mark- switch changed
 #pragma mark- switch changed
 - (void) switchIsChanged:(UISwitch *)paramSender{
 - (void) switchIsChanged:(UISwitch *)paramSender{
-    NSLog(@"Sender is = %@", paramSender);
+    
+    
+   // [self.switchlock lock];
+   // DebugLog(@"switch lock");
     
     
     
     
     UITableViewCell *cell = (UITableViewCell *) paramSender.superview.superview;
     UITableViewCell *cell = (UITableViewCell *) paramSender.superview.superview;
     NSIndexPath *   indexPath = [self.editorTable indexPathForCell:cell];
     NSIndexPath *   indexPath = [self.editorTable indexPathForCell:cell];
-    
+    if(indexPath==nil)
+    {
+        [paramSender setOn:!paramSender.isOn];
+        return ;
+    }
     
     
     NSMutableDictionary* section_json=nil;
     NSMutableDictionary* section_json=nil;
     
     
@@ -5987,6 +6000,8 @@
     {
     {
         [self refresh:refresh_trigger];
         [self refresh:refresh_trigger];
     }
     }
+    DebugLog(@"switch unlock");
+   // [self.switchlock unlock];
 }
 }
 
 
 -(NSMutableDictionary*) fill_switch_subitem:(NSMutableDictionary *) switch_item subid:(NSArray*) subid source:(NSMutableDictionary*)source mapping:(NSDictionary*)mapping //step:(int) step
 -(NSMutableDictionary*) fill_switch_subitem:(NSMutableDictionary *) switch_item subid:(NSArray*) subid source:(NSMutableDictionary*)source mapping:(NSDictionary*)mapping //step:(int) step

+ 9 - 3
RedAnt ERP Mobile/common/Functions/offline/SyncControlPanelViewController.m

@@ -112,7 +112,7 @@
     //    if(self.mail_content==nil)
     //    if(self.mail_content==nil)
     //        self.mail_content=@"";
     //        self.mail_content=@"";
     
     
-    NSString* htmlbody = [NSString stringWithFormat:@"<p>%@</p></br>%@,%@",@"Process description:",appinfo,userinfo];
+    NSString* htmlbody = [NSString stringWithFormat:@"<p>%@</p></br>%@%@",@"Process description:",appinfo,userinfo];
     
     
     [mc setMessageBody:htmlbody
     [mc setMessageBody:htmlbody
                 isHTML:YES];
                 isHTML:YES];
@@ -124,9 +124,15 @@
     //    if(self.attachment_name.length>0)
     //    if(self.attachment_name.length>0)
     //        filename = self.attachment_name;
     //        filename = self.attachment_name;
     
     
-//    data=[RAUtils getdbfile];
+    NSString* dbzippath= [RAUtils getdbzip];
+    NSData *data1 = [NSData dataWithContentsOfFile:dbzippath];
 //    filename=@"database.db";
 //    filename=@"database.db";
-    [mc addAttachmentData:data mimeType:@"text/plain" fileName:filename];
+    
+    
+    
+    [mc addAttachmentData:data mimeType:@"text/plain" fileName:@"offlinelog.txt"];
+    [mc addAttachmentData:data1 mimeType:@"text/plain" fileName:@"db.zip"];
+    
     [self presentModalViewController:mc animated:YES];
     [self presentModalViewController:mc animated:YES];
     
     
     return;
     return;

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

@@ -42,7 +42,7 @@ typedef void (^add_to_cart_Handler)(void);
 +(NSDictionary*) dictfromfile:(NSString*) path;
 +(NSDictionary*) dictfromfile:(NSString*) path;
 
 
 +(NSData*) getdbfile;
 +(NSData*) getdbfile;
-
++(NSString*) getdbzip;
 + (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size;
 + (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size;
 +(UIImage*)img_compress:(UIImage*)image kbsize:(float) size;
 +(UIImage*)img_compress:(UIImage*)image kbsize:(float) size;
 +(NSString* )current_date;
 +(NSString* )current_date;

+ 31 - 0
RedAnt ERP Mobile/common/RAUtils.m

@@ -11,7 +11,38 @@
 #import "MainViewController.h"
 #import "MainViewController.h"
 #import <sys/param.h>
 #import <sys/param.h>
 #import <sys/mount.h>
 #import <sys/mount.h>
+
+#import "ZipArchive.h"
 @implementation RAUtils
 @implementation RAUtils
+
+
++(NSString*) getdbzip
+{
+    
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *documents = /*[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];*/[paths objectAtIndex:0];
+    NSString *database_path = [documents stringByAppendingPathComponent:DBNAME];
+    
+    
+            NSString* temp = NSTemporaryDirectory();
+    
+    NSString* uuid=[[NSUUID UUID] UUIDString];
+    
+    NSString *tempfile = [temp stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.zip",uuid]];
+    
+    ZipArchive* zip = [[ZipArchive alloc] init];
+    
+    
+    BOOL result = [zip CreateZipFile2:tempfile Password:@"usai2010"];
+    
+
+        result = [zip addFileToZip:database_path newname:[database_path lastPathComponent]];
+    return tempfile;
+    
+    
+
+}
 +(NSData*) getdbfile
 +(NSData*) getdbfile
 {
 {
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);