Преглед изворни кода

160914
Modify: online add all function, optimise for consuming operation.

Ray Zhang пре 9 година
родитељ
комит
65d017559f

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


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

@@ -159,7 +159,7 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "2297"
             endingLineNumber = "2297"
-            landmarkName = "+offline_requestcart:"
+            landmarkName = "+model_subtotal:count:db:compute_part:"
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
@@ -243,5 +243,117 @@
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesNetwork.m"
+            timestampString = "495446395.813874"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "2538"
+            endingLineNumber = "2538"
+            landmarkName = "+Category_addall:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:orderCode:addTo:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesNetwork.m"
+            timestampString = "495446395.813874"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "2540"
+            endingLineNumber = "2540"
+            landmarkName = "+Category_addall:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:orderCode:addTo:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesNetwork.m"
+            timestampString = "495446395.813874"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "2541"
+            endingLineNumber = "2541"
+            landmarkName = "+Category_addall:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:orderCode:addTo:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesNetwork.m"
+            timestampString = "495446322.016074"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "2532"
+            endingLineNumber = "2532"
+            landmarkName = "+Category_addall:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:orderCode:addTo:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesNetwork.m"
+            timestampString = "495446401.150212"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "2535"
+            endingLineNumber = "2535"
+            landmarkName = "+Category_addall:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:orderCode:addTo:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesNetwork.m"
+            timestampString = "495446405.958479"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "2539"
+            endingLineNumber = "2539"
+            landmarkName = "+Category_addall:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:orderCode:addTo:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesNetwork.m"
+            timestampString = "495446528.078429"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "2534"
+            endingLineNumber = "2534"
+            landmarkName = "+Category_addall:customid:price_template:sort:filter:keyword:offset:limit:alert:qty:available:price:bestseller:modelname:modeldescrip:orderCode:addTo:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

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

@@ -2050,6 +2050,7 @@
     
 }
 
+
 +(NSData*) offline_add2cart :(NSMutableDictionary *) params;
 {
     NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];

+ 2 - 1
RedAnt ERP Mobile/common/const.h

@@ -70,6 +70,7 @@
 #define RESULT_UPDATE_USERAUTH_ERROR	 -11
 #define RESULT_SESSION_EXPIRED			  -13
 #define RESULT_VER_LOW                   -15
+#define RESULT_TIMEOUT                   99
 
 #define RESULT_LOGIN_DEVICE                   -18
 
@@ -88,7 +89,7 @@
 #define MSG_ERROR @"Connection failed with Server, please email your IT Admin."//@"Some error occured on server."
 #define MSG_SUCCESS @"Success."
 #define MSG_LOGIN_DEVICE @"Account already sign in from another device."
-
+#define MSG_TIMEOUT @"Request timeout."
 
 #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
 

+ 74 - 7
RedAnt ERP Mobile/common/data_provider/iSalesNetwork.m

@@ -318,6 +318,9 @@ repeat:
                 case 9:
                     [jsobj setValue:[jsobj valueForKey:@"msg"] forKey:@"err_msg"];
                     break;
+                case 99:
+                    [jsobj setValue:MSG_TIMEOUT forKey:@"err_msg"];
+                    break;
                 default:
                     [jsobj setValue:MSG_ERROR forKey:@"err_msg"];
                     break;
@@ -330,7 +333,7 @@ repeat:
                 [jsobj setValue:MSG_VER_LOW forKey:@"err_msg"];
             }
             
-            if(![url isEqualToString:URL_ERR_LOG]&&![url isEqualToString:URL_DOWNLOAD_OFFLINE]/*&&result!=-3*/&&result!=2)
+            if(![url isEqualToString:URL_ERR_LOG]&&![url isEqualToString:URL_DOWNLOAD_OFFLINE]/*&&result!=-3*/&&result!=2&&result!=99)
             {
                 [iSalesNetwork err_log:[RAUtils base64en:[RAUtils dict2string:params]] result:[RAUtils base64en:str] module:url code:result];
             }
@@ -2515,10 +2518,34 @@ repeat:
     }
     else
     {
-    if(![self IsNetworkAvailable])
-        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
-    
-    json=[self get_json:URL_CATEGORYADDALL parameters:params];
+        if(![self IsNetworkAvailable])
+            return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        
+
+        NSError *error=nil;
+
+        NSString * uuid= [[NSUUID UUID] UUIDString];
+        params[@"resultSerial"]=uuid;
+        
+        for(int i=0;i<150;i++)
+        {
+ //           NSMutableDictionary* result_params = [[NSMutableDictionary alloc]init];
+//            result_params[@"resultSerial"]=uuid;
+            json=[self get_json:URL_CATEGORYADDALL parameters:params];
+            if(json!=nil)
+            {
+                
+                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+                if([jsobj[@"result"] intValue]==2)
+                {
+                    break;
+                }
+            }
+            sleep(2);
+        }
+
+       
+        
     }
     if(json==nil)
         return nil;
@@ -2722,7 +2749,27 @@ repeat:
     if(![self IsNetworkAvailable])
         return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
     
-    json=[self get_json:URL_SEARCHADDALL parameters:params];
+        NSError *error=nil;
+        
+        NSString * uuid= [[NSUUID UUID] UUIDString];
+        params[@"resultSerial"]=uuid;
+        
+        for(int i=0;i<150;i++)
+        {
+            //           NSMutableDictionary* result_params = [[NSMutableDictionary alloc]init];
+            //            result_params[@"resultSerial"]=uuid;
+            json=[self get_json:URL_SEARCHADDALL parameters:params];
+            if(json!=nil)
+            {
+                
+                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+                if([jsobj[@"result"] intValue]==2)
+                {
+                    break;
+                }
+            }
+            sleep(2);
+        }
     }
     if(json==nil)
         return nil;
@@ -2822,7 +2869,27 @@ repeat:
     {
     if(![self IsNetworkAvailable])
         return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
-     json=[self get_json:URL_ITEMSEARCHADDALL parameters:params];
+        NSError *error=nil;
+        
+        NSString * uuid= [[NSUUID UUID] UUIDString];
+        params[@"resultSerial"]=uuid;
+        
+        for(int i=0;i<150;i++)
+        {
+            //           NSMutableDictionary* result_params = [[NSMutableDictionary alloc]init];
+            //            result_params[@"resultSerial"]=uuid;
+            json=[self get_json:URL_ITEMSEARCHADDALL parameters:params];
+            if(json!=nil)
+            {
+                
+                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+                if([jsobj[@"result"] intValue]==2)
+                {
+                    break;
+                }
+            }
+            sleep(2);
+        }
     }
     if(json==nil)
         return nil;

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

@@ -136,6 +136,8 @@
 #define  URL_DOWNLOAD_OFFLINE  @"http://192.168.0.126:8080/site/offline/downloadDatas.htm"
 #define  URL_FINISH_DOWNLOAD_OFFLINE  @"http://192.168.0.126:8080/site/offline/confirmVersion.htm"
 
+
+#define  URL_GET_RESULT  @"http://192.168.0.126:8080/site/offline/getResultBySerial.htm"
 #else