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

161031
New:
new logic allow app fully sync once when version updated.
Fix:
portfolio discount is wrong.
some of portfolio switch parameters not working.

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

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


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

@@ -639,7 +639,7 @@
             endingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "10342"
             startingLineNumber = "10342"
             endingLineNumber = "10342"
             endingLineNumber = "10342"
-            landmarkName = "+offline_save_TearSheet:"
+            landmarkName = "+offline_savePDF:direct:"
             landmarkType = "7">
             landmarkType = "7">
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>
@@ -762,11 +762,11 @@
             ignoreCount = "0"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             continueAfterRunningActions = "No"
             filePath = "common/RAUtils.m"
             filePath = "common/RAUtils.m"
-            timestampString = "499332075.882414"
+            timestampString = "499757994.506583"
             startingColumnNumber = "9223372036854775807"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "225"
-            endingLineNumber = "225"
+            startingLineNumber = "251"
+            endingLineNumber = "251"
             landmarkName = "+rectVAlign:rect:vAlign:"
             landmarkName = "+rectVAlign:rect:vAlign:"
             landmarkType = "7">
             landmarkType = "7">
          </BreakpointContent>
          </BreakpointContent>
@@ -1011,5 +1011,69 @@
             landmarkType = "7">
             landmarkType = "7">
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "iSales-NPD/AppDelegate.m"
+            timestampString = "499750289.63805"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1760"
+            endingLineNumber = "1760"
+            landmarkName = "-download_offline:checkdiskspace:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/RAUtils.m"
+            timestampString = "499756839.703485"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "224"
+            endingLineNumber = "224"
+            landmarkName = "+get_config_path"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "iSales-NPD/AppDelegate.m"
+            timestampString = "499757986.854295"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1277"
+            endingLineNumber = "1277"
+            landmarkName = "-download_offline:useInternalAddress:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/Functions/offline/OLDataProvider.m"
+            timestampString = "499759589.353113"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "262"
+            endingLineNumber = "262"
+            landmarkName = "+prepare_portfolio_data:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
    </Breakpoints>
 </Bucket>
 </Bucket>

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

@@ -247,25 +247,25 @@
         str_legcolor=@"";
         str_legcolor=@"";
         if([params[@"dimension"] boolValue]==false || demension.length==0 )
         if([params[@"dimension"] boolValue]==false || demension.length==0 )
         str_demension=@"";
         str_demension=@"";
-        if([params[@"seat_height"] boolValue]==false && seat_height.length==0 )
+        if([params[@"seat_height"] boolValue]==false || seat_height.length==0 )
         str_seat_height=@"";
         str_seat_height=@"";
-        if([params[@"material"] boolValue]==false && material.length==0 )
+        if([params[@"material"] boolValue]==false || material.length==0 )
         str_meterial=@"";
         str_meterial=@"";
-        if([params[@"box_dimension"] boolValue]==false && box_dim.length==0 )
+        if([params[@"box_dimension"] boolValue]==false || box_dim.length==0 )
         str_box_dim=@"";
         str_box_dim=@"";
-        if([params[@"volume"] boolValue]==false && s_volume.length==0 )
+        if([params[@"volume"] boolValue]==false || s_volume.length==0 )
         str_volume=@"";
         str_volume=@"";
-        if([params[@"weight"] boolValue]==false && s_weight.length==0 )
+        if([params[@"weight"] boolValue]==false || s_weight.length==0 )
         str_weight=@"";
         str_weight=@"";
-        if([params[@"load_ability"] boolValue]==false && s_load_ability.length==0 )
+        if([params[@"load_ability"] boolValue]==false || s_load_ability.length==0 )
         str_load_ability=@"";
         str_load_ability=@"";
-        if([params[@"fabric_content"] boolValue]==false && fabric_content.length==0 )
+        if([params[@"fabric_content"] boolValue]==false || fabric_content.length==0 )
         str_fabric_content=@"";
         str_fabric_content=@"";
-        if([params[@"assembling"] boolValue]==false && assembling.length==0 )
+        if([params[@"assembling"] boolValue]==false || assembling.length==0 )
         str_assembling=@"";
         str_assembling=@"";
-        if([params[@"made"] boolValue]==false && made_in.length==0 )
+        if([params[@"made"] boolValue]==false || made_in.length==0 )
         str_made_in=@"";
         str_made_in=@"";
-        if([params[@"show_line_note"] boolValue]==false && line_note.length==0 )
+        if([params[@"show_line_note"] boolValue]==false || line_note.length==0 )
         str_line_note=@"";
         str_line_note=@"";
         
         
         NSMutableArray* arr_detail=[[NSMutableArray alloc]init];
         NSMutableArray* arr_detail=[[NSMutableArray alloc]init];
@@ -315,7 +315,7 @@
         }
         }
         else
         else
         {
         {
-            set_price=[NSString stringWithFormat:@"Special: $ %.2f",price*(1-discount)];
+            set_price=[NSString stringWithFormat:@"Special: $ %.2f",price*(1-discount/100.0)];
         }
         }
         NSString* get_price=@"";
         NSString* get_price=@"";
         {
         {

+ 2 - 0
RedAnt ERP Mobile/common/RAUtils.h

@@ -29,6 +29,8 @@ typedef void (^add_to_cart_Handler)(void);
 + (float)fileSizeForDir:(NSString*)path;//计算文件夹下文件的总大小;
 + (float)fileSizeForDir:(NSString*)path;//计算文件夹下文件的总大小;
 +(void) deletefiles :(NSString*) path;
 +(void) deletefiles :(NSString*) path;
 +(UIColor*) strColor:(NSString*) color;
 +(UIColor*) strColor:(NSString*) color;
+
++(NSString*) get_config_path;
 +(NSDictionary*) string2dict:(NSString*) str;
 +(NSDictionary*) string2dict:(NSString*) str;
 +(NSString*) dict2string:(NSDictionary*) dict;
 +(NSString*) dict2string:(NSDictionary*) dict;
 +(NSString*) arr2string:(NSArray *) arr separator:(NSString*)separator trim:(bool) btrim;
 +(NSString*) arr2string:(NSArray *) arr separator:(NSString*)separator trim:(bool) btrim;

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

@@ -218,6 +218,32 @@
     return rect;
     return rect;
     
     
 }
 }
+
++(NSString*) get_config_path
+{
+    NSString *default_path = [[NSBundle mainBundle] pathForResource:@"config" ofType:@"plist"];
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *cache_folder=[paths objectAtIndex:0];
+    
+    NSString* ver=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
+    
+    NSString *config_path = [cache_folder stringByAppendingPathComponent:[NSString stringWithFormat: @"config_%@.plist",ver]];
+    BOOL bdir=NO;
+    NSFileManager* fileManager = [NSFileManager defaultManager];
+    if(!  [fileManager fileExistsAtPath:config_path isDirectory:&bdir])
+    {
+        NSError * error=nil;
+        
+        if(![fileManager copyItemAtPath:default_path toPath:config_path error:&error])
+        {
+            return nil;
+        }
+    }
+    
+    
+   
+    return config_path;
+}
 + (CGRect)rectVAlign:(CGRect )parent rect:(CGRect)rect vAlign:(NSString*)vAlign
 + (CGRect)rectVAlign:(CGRect )parent rect:(CGRect)rect vAlign:(NSString*)vAlign
 {
 {
     //    double cx=parent.origin.x+parent.size.width/2;
     //    double cx=parent.origin.x+parent.size.width/2;

+ 4 - 0
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -229,6 +229,7 @@
 		71DF74961C57614C00F2789C /* PhotoBorder@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 71DF74901C57614C00F2789C /* PhotoBorder@2x.png */; };
 		71DF74961C57614C00F2789C /* PhotoBorder@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 71DF74901C57614C00F2789C /* PhotoBorder@2x.png */; };
 		71DF74971C57614C00F2789C /* PhotoStackView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74921C57614C00F2789C /* PhotoStackView.m */; };
 		71DF74971C57614C00F2789C /* PhotoStackView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74921C57614C00F2789C /* PhotoStackView.m */; };
 		71DF74981C57614C00F2789C /* PhotoStackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74941C57614C00F2789C /* PhotoStackViewController.m */; };
 		71DF74981C57614C00F2789C /* PhotoStackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DF74941C57614C00F2789C /* PhotoStackViewController.m */; };
+		71E5A0101DC99370005BF655 /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 71E5A00F1DC99370005BF655 /* config.plist */; };
 		71FFBBE91C60894900D91DC2 /* iSalesDB.m in Sources */ = {isa = PBXBuildFile; fileRef = 71FFBBE61C60894900D91DC2 /* iSalesDB.m */; };
 		71FFBBE91C60894900D91DC2 /* iSalesDB.m in Sources */ = {isa = PBXBuildFile; fileRef = 71FFBBE61C60894900D91DC2 /* iSalesDB.m */; };
 		71FFBBEA1C60894900D91DC2 /* iSalesNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 71FFBBE81C60894900D91DC2 /* iSalesNetwork.m */; };
 		71FFBBEA1C60894900D91DC2 /* iSalesNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 71FFBBE81C60894900D91DC2 /* iSalesNetwork.m */; };
 		A31E80CF7BEA220BD1CC4B97 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C694180C757B34E24180D628 /* libPods.a */; };
 		A31E80CF7BEA220BD1CC4B97 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C694180C757B34E24180D628 /* libPods.a */; };
@@ -642,6 +643,7 @@
 		71DF74921C57614C00F2789C /* PhotoStackView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PhotoStackView.m; path = common/photoStack/PhotoStackView.m; sourceTree = SOURCE_ROOT; };
 		71DF74921C57614C00F2789C /* PhotoStackView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PhotoStackView.m; path = common/photoStack/PhotoStackView.m; sourceTree = SOURCE_ROOT; };
 		71DF74931C57614C00F2789C /* PhotoStackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhotoStackViewController.h; path = common/photoStack/PhotoStackViewController.h; sourceTree = SOURCE_ROOT; };
 		71DF74931C57614C00F2789C /* PhotoStackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PhotoStackViewController.h; path = common/photoStack/PhotoStackViewController.h; sourceTree = SOURCE_ROOT; };
 		71DF74941C57614C00F2789C /* PhotoStackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PhotoStackViewController.m; path = common/photoStack/PhotoStackViewController.m; sourceTree = SOURCE_ROOT; };
 		71DF74941C57614C00F2789C /* PhotoStackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PhotoStackViewController.m; path = common/photoStack/PhotoStackViewController.m; sourceTree = SOURCE_ROOT; };
+		71E5A00F1DC99370005BF655 /* config.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = config.plist; sourceTree = "<group>"; };
 		71FFBBE51C60894900D91DC2 /* iSalesDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iSalesDB.h; path = common/data_provider/iSalesDB.h; sourceTree = SOURCE_ROOT; };
 		71FFBBE51C60894900D91DC2 /* iSalesDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iSalesDB.h; path = common/data_provider/iSalesDB.h; sourceTree = SOURCE_ROOT; };
 		71FFBBE61C60894900D91DC2 /* iSalesDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = iSalesDB.m; path = common/data_provider/iSalesDB.m; sourceTree = SOURCE_ROOT; };
 		71FFBBE61C60894900D91DC2 /* iSalesDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = iSalesDB.m; path = common/data_provider/iSalesDB.m; sourceTree = SOURCE_ROOT; };
 		71FFBBE71C60894900D91DC2 /* iSalesNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iSalesNetwork.h; path = common/data_provider/iSalesNetwork.h; sourceTree = SOURCE_ROOT; };
 		71FFBBE71C60894900D91DC2 /* iSalesNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iSalesNetwork.h; path = common/data_provider/iSalesNetwork.h; sourceTree = SOURCE_ROOT; };
@@ -1078,6 +1080,7 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				716387D3195408E7006E65E6 /* config.h */,
 				716387D3195408E7006E65E6 /* config.h */,
+				71E5A00F1DC99370005BF655 /* config.plist */,
 			);
 			);
 			name = config;
 			name = config;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -1521,6 +1524,7 @@
 				7161FEB51D61B24900157EE1 /* creditcardpayment.html in Resources */,
 				7161FEB51D61B24900157EE1 /* creditcardpayment.html in Resources */,
 				71777FC61C8AC97300DA2511 /* debug_category_filter.json in Resources */,
 				71777FC61C8AC97300DA2511 /* debug_category_filter.json in Resources */,
 				712AFEE71DBDB48000254965 /* portfolio_3x2.json in Resources */,
 				712AFEE71DBDB48000254965 /* portfolio_3x2.json in Resources */,
+				71E5A0101DC99370005BF655 /* config.plist in Resources */,
 				71DF74951C57614C00F2789C /* PhotoBorder.png in Resources */,
 				71DF74951C57614C00F2789C /* PhotoBorder.png in Resources */,
 				7162A55F1C58724700AB630E /* customer_info_template.json in Resources */,
 				7162A55F1C58724700AB630E /* customer_info_template.json in Resources */,
 				71D46D111CE1D9EF00A081AC /* OLM.storyboard in Resources */,
 				71D46D111CE1D9EF00A081AC /* OLM.storyboard in Resources */,

+ 20 - 1
RedAnt ERP Mobile/iSales-NPD/AppDelegate.m

@@ -22,7 +22,7 @@
 #import "CreateOrderViewController.h"
 #import "CreateOrderViewController.h"
 #import "OrderDetailViewController.h"
 #import "OrderDetailViewController.h"
 #import "AddressEditorViewController.h"
 #import "AddressEditorViewController.h"
-
+#import "config.h"
 #define UNZIP_OPEN_FAILED 0
 #define UNZIP_OPEN_FAILED 0
 #define UNZIP_SUCCESS 1
 #define UNZIP_SUCCESS 1
 #define UNZIP_NO_SPACE 2
 #define UNZIP_NO_SPACE 2
@@ -758,6 +758,8 @@ void UncaughtExceptionHandler(NSException *exception) {
 
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
 {
+
+    
     
     
 //    [RAUtils expression_varable:nil regex:nil];
 //    [RAUtils expression_varable:nil regex:nil];
     self.disable_trigger = false;
     self.disable_trigger = false;
@@ -1272,6 +1274,14 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 }
 -(void) download_offline:(NSString*) ver useInternalAddress:(bool)buseinternaladdress
 -(void) download_offline:(NSString*) ver useInternalAddress:(bool)buseinternaladdress
 {
 {
+    NSString *plistPath = [RAUtils get_config_path];
+    NSMutableDictionary *config_list = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
+    if([config_list[@"NEED_FULLY_SYNC"] boolValue])
+    {
+        ver= nil;
+    }
+    
+    
     if(self.downloading)
     if(self.downloading)
         return;
         return;
     
     
@@ -1744,6 +1754,15 @@ void UncaughtExceptionHandler(NSException *exception) {
                 [defaults removeObjectForKey:@"OFFLINE_DIRTY"];
                 [defaults removeObjectForKey:@"OFFLINE_DIRTY"];
                 [defaults setBool:FALSE forKey:@"OFFLINE_DIRTY"];
                 [defaults setBool:FALSE forKey:@"OFFLINE_DIRTY"];
                 [defaults synchronize];
                 [defaults synchronize];
+                
+                NSString *plistPath = [RAUtils get_config_path];
+                NSMutableDictionary *config_list = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
+                if([config_list[@"NEED_FULLY_SYNC"] boolValue])
+                {
+                    config_list[@"NEED_FULLY_SYNC"] = @"false";
+                    [config_list writeToFile:plistPath atomically:YES];
+                }
+                
                 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                     
                     
                     
                     

+ 2 - 0
RedAnt ERP Mobile/iSales-NPD/config.h

@@ -13,6 +13,8 @@
 #define test_server
 #define test_server
 #define exception_switch 0
 #define exception_switch 0
 
 
+
+
 #define PDF_DEBUG true
 #define PDF_DEBUG true
 
 
 //#define ENCRYPT_OFF
 //#define ENCRYPT_OFF

+ 8 - 0
RedAnt ERP Mobile/iSales-NPD/config.plist

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>NEED_FULLY_SYNC</key>
+	<true/>
+</dict>
+</plist>