Prechádzať zdrojové kódy

修改Category Add All,处理结果为8时不再重复请求。
新建ERPUtils,从RAUtils将方法orderStatus:移动到ERPUtils。

Pen Li 9 rokov pred
rodič
commit
38b7d92dfa

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


+ 15 - 0
RedAnt ERP Mobile/common/ERPUtils.h

@@ -0,0 +1,15 @@
+//
+//  ERPUtils.h
+//  iSales-NPD
+//
+//  Created by Jack on 2017/2/13.
+//  Copyright © 2017年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface ERPUtils : NSObject
+
++ (NSString *)orderStatus:(NSInteger)statusCode;
+
+@end

+ 58 - 0
RedAnt ERP Mobile/common/ERPUtils.m

@@ -0,0 +1,58 @@
+//
+//  ERPUtils.m
+//  iSales-NPD
+//
+//  Created by Jack on 2017/2/13.
+//  Copyright © 2017年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "ERPUtils.h"
+#import "AppDelegate.h"
+#import "Singleton.h"
+
+
+@implementation ERPUtils
+
++ (NSString *)orderStatus:(NSInteger)statusCode {
+    
+    __block NSString *status = nil;
+    
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    NSDictionary *filter = nil;
+    switch (appDelegate.user_type) {
+        case USER_ROLE_EMPLOYEE: {
+            filter = appDelegate.OrderFilter;
+        }
+            break;
+        case USER_ROLE_CUSTOMER: {
+            if ([Singleton sharedInstance].customer_order_type == 0) {
+                filter = [Singleton sharedInstance].shop_order_status_filter;
+            } else {
+                filter = [Singleton sharedInstance].sales_order_status_filter;
+            }
+        }
+            break;
+        case USER_ROLE_UNKNOWN: {
+            
+        }
+            
+        default:
+            break;
+    }
+    
+    [filter enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
+        
+        if ([obj isKindOfClass:[NSDictionary class]]) {
+            NSDictionary *orderStatusDic = (NSDictionary *)obj;
+            if ([[orderStatusDic objectForKey:@"value_id"] integerValue] == statusCode) {
+                status = [orderStatusDic objectForKey:@"value"];
+                *stop = YES;
+            }
+        }
+        
+    }];
+    
+    return status;
+}
+
+@end

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

@@ -65,6 +65,5 @@
 
 + (bool)mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir error:(NSError**)err;
 
-+ (NSString *)orderStatus:(NSInteger)statusCode;
 
 @end

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

@@ -855,47 +855,6 @@ begin:
     //    return CGRectMake(x, y, v.frame.size.width, v.frame.size.height);
 }
 
-+ (NSString *)orderStatus:(NSInteger)statusCode {
-    
-    __block NSString *status = nil;
-    
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    NSDictionary *filter = nil;
-    switch (appDelegate.user_type) {
-        case USER_ROLE_EMPLOYEE: {
-            filter = appDelegate.OrderFilter;
-        }
-            break;
-        case USER_ROLE_CUSTOMER: {
-            if ([Singleton sharedInstance].customer_order_type == 0) {
-                filter = [Singleton sharedInstance].shop_order_status_filter;
-            } else {
-                filter = [Singleton sharedInstance].sales_order_status_filter;
-            }
-        }
-            break;
-        case USER_ROLE_UNKNOWN: {
-            
-        }
-            
-        default:
-            break;
-    }
-    
-    [filter enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
-        
-        if ([obj isKindOfClass:[NSDictionary class]]) {
-            NSDictionary *orderStatusDic = (NSDictionary *)obj;
-            if ([[orderStatusDic objectForKey:@"value_id"] integerValue] == statusCode) {
-                status = [orderStatusDic objectForKey:@"value"];
-                *stop = YES;
-            }
-        }
-        
-    }];
-    
-    return status;
-}
 
 @end
 

+ 2 - 1
RedAnt ERP Mobile/common/data_provider/iSalesNetwork.m

@@ -2749,7 +2749,8 @@ repeat:
             {
                 
                 NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
-                if([jsobj[@"result"] intValue]==2)
+                int resultInt = [jsobj[@"result"] intValue];
+                if(resultInt == 2 || resultInt == 8)
                 {
                     break;
                 }

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

@@ -31,6 +31,7 @@
 		42A51BF61D62F9AB00F13667 /* orderDetail.json in Resources */ = {isa = PBXBuildFile; fileRef = 42A51BF51D62F9AB00F13667 /* orderDetail.json */; };
 		42B309791E45BA32007AFC62 /* status_filter_cadedate_po.json in Resources */ = {isa = PBXBuildFile; fileRef = 42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */; };
 		42B3C9BB1D642C880053985C /* order_info.html in Resources */ = {isa = PBXBuildFile; fileRef = 42B3C9BA1D642C880053985C /* order_info.html */; };
+		42BF67CC1E5179970081F90A /* ERPUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BF67CB1E5179970081F90A /* ERPUtils.m */; };
 		42C2E8BC1DB49D02006C0495 /* TearSheet.json in Resources */ = {isa = PBXBuildFile; fileRef = 42C2E8BB1DB49D02006C0495 /* TearSheet.json */; };
 		42C9FB151D5B28FA001DCA8B /* contactAdvanceSearch.json in Resources */ = {isa = PBXBuildFile; fileRef = 42C9FB141D5B28FA001DCA8B /* contactAdvanceSearch.json */; };
 		42DC31131D546FBE00BCD1C6 /* category.json in Resources */ = {isa = PBXBuildFile; fileRef = 42DC31121D546FBE00BCD1C6 /* category.json */; };
@@ -286,6 +287,8 @@
 		42A51BF51D62F9AB00F13667 /* orderDetail.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = orderDetail.json; sourceTree = "<group>"; };
 		42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = status_filter_cadedate_po.json; path = common/Functions/order/status_filter_cadedate_po.json; sourceTree = SOURCE_ROOT; };
 		42B3C9BA1D642C880053985C /* order_info.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = order_info.html; sourceTree = "<group>"; };
+		42BF67CA1E5179970081F90A /* ERPUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ERPUtils.h; path = common/ERPUtils.h; sourceTree = SOURCE_ROOT; };
+		42BF67CB1E5179970081F90A /* ERPUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ERPUtils.m; path = common/ERPUtils.m; sourceTree = SOURCE_ROOT; };
 		42C2E8BB1DB49D02006C0495 /* TearSheet.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = TearSheet.json; sourceTree = "<group>"; };
 		42C9FB141D5B28FA001DCA8B /* contactAdvanceSearch.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = contactAdvanceSearch.json; sourceTree = "<group>"; };
 		42DC31121D546FBE00BCD1C6 /* category.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = category.json; sourceTree = "<group>"; };
@@ -1087,6 +1090,8 @@
 				71D01B171E0A2055006620CE /* PDFUtils.m */,
 				71D01B181E0A2055006620CE /* TextUtils.h */,
 				71D01B191E0A2055006620CE /* TextUtils.m */,
+				42BF67CA1E5179970081F90A /* ERPUtils.h */,
+				42BF67CB1E5179970081F90A /* ERPUtils.m */,
 				71FFBBE51C60894900D91DC2 /* iSalesDB.h */,
 				71FFBBE61C60894900D91DC2 /* iSalesDB.m */,
 				71FFBBE71C60894900D91DC2 /* iSalesNetwork.h */,
@@ -1837,6 +1842,7 @@
 				7162A5CA1C58761500AB630E /* SignatureView.m in Sources */,
 				7162A5181C58704600AB630E /* CartViewController.m in Sources */,
 				71DF74601C575E7900F2789C /* CommonEditorCellMAction.m in Sources */,
+				42BF67CC1E5179970081F90A /* ERPUtils.m in Sources */,
 				71DF745F1C575E7900F2789C /* CommonEditorCellLabel.m in Sources */,
 				7141DD3C1C5726B700F7DF59 /* ScanApiHelper.mm in Sources */,
 				7162A5261C58706C00AB630E /* CategoryViewController.m in Sources */,