Przeglądaj źródła

修改Order List Lock为Global Lock

Pen Li 9 lat temu
rodzic
commit
243311ace3

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


+ 39 - 24
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -1708,10 +1708,10 @@
         [self.sideMenuItems addObject:map.copy];
     }
     if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
-        if ([Singleton sharedInstance].order_list_lock) {
-            [map setValue:@"Order List unLock" forKey:@"title"];
+        if ([Singleton sharedInstance].global_lock) {
+            [map setValue:@"unLock" forKey:@"title"];
         } else {
-            [map setValue:@"Order List Lock" forKey:@"title"];
+            [map setValue:@"Lock" forKey:@"title"];
         }
         
         [self.sideMenuItems addObject:map.copy];
@@ -2192,7 +2192,7 @@
         UIApplication * app = [UIApplication sharedApplication];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         
-        if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
+        if (appDelegate.user_type == USER_ROLE_CUSTOMER && [Singleton sharedInstance].global_lock) {
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
@@ -2226,7 +2226,7 @@
         UIApplication * app = [UIApplication sharedApplication];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         
-        if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
+        if (appDelegate.user_type == USER_ROLE_CUSTOMER && [Singleton sharedInstance].global_lock) {
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
@@ -2315,30 +2315,45 @@
         UIApplication * app = [UIApplication sharedApplication];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         
-        JKLockController *lockVC = [[JKLockController alloc] init];
-        [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
-        __weak typeof(self) weakself = self;
-        lockVC.authoReturn = ^(BOOL failure) {
+        if ([Singleton sharedInstance].global_lock) {
             
-            if (weakself) {
-                __strong typeof(weakself) strongself = weakself;
-                
-                PriceSettingViewController *priceSettingVC =[ [UIStoryboard storyboardWithName:@"CUL" bundle:nil] instantiateViewControllerWithIdentifier:@"PriceSettingViewController"];
-                
-                UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:priceSettingVC] ;
+            JKLockController *lockVC = [[JKLockController alloc] init];
+            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+            __weak typeof(self) weakself = self;
+            lockVC.authoReturn = ^(BOOL failure) {
                 
-                navi.navigationBar.translucent = NO;
-                navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
-                [strongself presentViewController:navi animated:YES completion:^{
+                if (weakself) {
+                    __strong typeof(weakself) strongself = weakself;
                     
-                }];
+                    PriceSettingViewController *priceSettingVC =[ [UIStoryboard storyboardWithName:@"CUL" bundle:nil] instantiateViewControllerWithIdentifier:@"PriceSettingViewController"];
+                    
+                    UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:priceSettingVC] ;
+                    
+                    navi.navigationBar.translucent = NO;
+                    navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+                    [strongself presentViewController:navi animated:YES completion:^{
+                        
+                    }];
+                    
+                }
+            };
+            [self.navigationController pushViewController:lockVC animated:YES];
+            
+        } else {
+            
+            PriceSettingViewController *priceSettingVC =[ [UIStoryboard storyboardWithName:@"CUL" bundle:nil] instantiateViewControllerWithIdentifier:@"PriceSettingViewController"];
+            
+            UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:priceSettingVC] ;
+            
+            navi.navigationBar.translucent = NO;
+            navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
+            [self presentViewController:navi animated:YES completion:^{
                 
-            }
-        };
-        [self.navigationController pushViewController:lockVC animated:YES];
+            }];
+        }
         
         
-    } else if ([title isEqualToString:@"Order List Lock"] || [title isEqualToString:@"Order List unLock"]) {
+    } else if ([title isEqualToString:@"Lock"] || [title isEqualToString:@"unLock"]) {
         
         UIApplication * app = [UIApplication sharedApplication];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
@@ -2351,7 +2366,7 @@
             if (weakself) {
                 __strong typeof(weakself) strongself = weakself;
                 
-                [Singleton sharedInstance].order_list_lock = ![Singleton sharedInstance].order_list_lock;
+                [Singleton sharedInstance].global_lock = ![Singleton sharedInstance].global_lock;
                 [strongself initMenuItems];
                 [strongself hideMenu];
             }

+ 5 - 5
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -112,8 +112,8 @@
     self.label_net_err.layer.masksToBounds=true;
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePriceType:) name:Change_Price_Type_Notification object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(lockOrderListNotification:) name:Lock_Order_List_Notification object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(lockOrderListNotification:) name:unLock_Order_List_Notification object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(lockOrderListNotification:) name:Lock_Permission_Notification object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(lockOrderListNotification:) name:unLock_Permission_Notification object:nil];
     
     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
     //            tap.minimumPressDuration = 0.8; //定义按的时间
@@ -125,7 +125,7 @@
     // Customer Order Type 0 Shop Order/ 1 Sales Order
     self.orderType = self.orderTypeSegmentControl.selectedSegmentIndex;
     [Singleton sharedInstance].customer_order_type = self.orderType;
-    if ([Singleton sharedInstance].order_list_lock) {
+    if ([Singleton sharedInstance].global_lock) {
         [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
     }
     
@@ -1070,7 +1070,7 @@
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 
     if(appDelegate.user_type==USER_ROLE_CUSTOMER) { // Customer
-        if ([Singleton sharedInstance].order_list_lock) { // Order list 被锁
+        if ([Singleton sharedInstance].global_lock) { // Order list 被锁
             return;
         }
     }
@@ -1777,7 +1777,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
 }
 
 - (void)lockOrderListNotification:(NSNotification *)notification {
-    if ([notification.name isEqual:Lock_Order_List_Notification]) {
+    if ([notification.name isEqual:Lock_Permission_Notification]) {
         [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
     } else {
         [self.orderTypeSegmentControl insertSegmentWithTitle:@"Sales Order" atIndex:1 animated:YES];

+ 2 - 2
RedAnt ERP Mobile/iSales-NPD/NotificationNameCenter.h

@@ -16,8 +16,8 @@ UIKIT_EXTERN  NSString  *Change_Price_Type_Notification;///<切换价格通知
 
 UIKIT_EXTERN  NSString  *No_Rights_Notification;///<无权
 
-UIKIT_EXTERN  NSString  *Lock_Order_List_Notification;///<Customer锁Order List
+UIKIT_EXTERN  NSString  *Lock_Permission_Notification;///<Customer锁Order List
 
-UIKIT_EXTERN  NSString  *unLock_Order_List_Notification;///<Customer解锁Order List
+UIKIT_EXTERN  NSString  *unLock_Permission_Notification;///<Customer解锁Order List
 
 @end

+ 2 - 2
RedAnt ERP Mobile/iSales-NPD/NotificationNameCenter.m

@@ -16,8 +16,8 @@ const NSString  *Change_Price_Type_Notification = @"Change_Price_Type_Notificati
 
 const NSString  *No_Rights_Notification = @"No_Rights_Notification";
 
-const NSString  *Lock_Order_List_Notification = @"Lock_Order_List_Notification";
+const NSString  *Lock_Permission_Notification = @"Lock_Permission_Notification";
 
-const NSString  *unLock_Order_List_Notification = @"unLock_Order_List_Notification";
+const NSString  *unLock_Permission_Notification = @"unLock_Permission_Notification";
 
 @end

+ 1 - 1
RedAnt ERP Mobile/iSales-NPD/Singleton.h

@@ -30,7 +30,7 @@ typedef enum {
 // 使用枚举吗?Customer_Oder_Type
 @property (nonatomic,assign) NSInteger customer_order_type;///< 0 Shop Order/ 1 Sales Order,
 
-@property (nonatomic,assign) BOOL order_list_lock;///<设置订单表单锁,Yes表示订单不能查看Detail
+@property (nonatomic,assign) BOOL global_lock;///<全局锁,Yes表示订单不能查看Detail,需要密码验证Price Setting,Hide Price
 
 #pragma mark - Employee 
 

+ 5 - 5
RedAnt ERP Mobile/iSales-NPD/Singleton.m

@@ -20,12 +20,12 @@
     return singleton;
 }
 
-- (void)setOrder_list_lock:(BOOL)order_list_lock {
-    _order_list_lock = order_list_lock;
-    if (order_list_lock) {
-        [[NSNotificationCenter defaultCenter] postNotificationName:Lock_Order_List_Notification object:nil];
+- (void)setGlobal_lock:(BOOL)global_lock {
+    _global_lock = global_lock;
+    if (global_lock) {
+        [[NSNotificationCenter defaultCenter] postNotificationName:Lock_Permission_Notification object:nil];
     } else {
-        [[NSNotificationCenter defaultCenter] postNotificationName:unLock_Order_List_Notification object:nil];
+        [[NSNotificationCenter defaultCenter] postNotificationName:unLock_Permission_Notification object:nil];
     }
 }