Parcourir la source

修改锁定Order List。

Pen Li il y a 9 ans
Parent
commit
0594ce757f

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


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

@@ -112,7 +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];
     
     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(refresh_btn_click:)];
     //            tap.minimumPressDuration = 0.8; //定义按的时间
@@ -124,6 +125,9 @@
     // 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) {
+        [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
+    }
     
     UIRefreshControl *ref = [[UIRefreshControl alloc]init];
     ref.tag = 201 ;
@@ -1063,9 +1067,12 @@
     //
     if(indexPath.row==self.content_data.count)
         return;
-    
-    if ([Singleton sharedInstance].order_list_lock) { // Order list 被锁
-        return;
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+
+    if(appDelegate.user_type==USER_ROLE_CUSTOMER) { // Customer
+        if ([Singleton sharedInstance].order_list_lock) { // Order list 被锁
+            return;
+        }
     }
     
     NSString* orderid= [self.content_data[indexPath.row] valueForKey:@"order_id"];
@@ -1769,5 +1776,13 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     [self ReloadData];
 }
 
+- (void)lockOrderListNotification:(NSNotification *)notification {
+    if ([notification.name isEqual:Lock_Order_List_Notification]) {
+        [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
+    } else {
+        [self.orderTypeSegmentControl insertSegmentWithTitle:@"Sales Order" atIndex:1 animated:YES];
+    }
+}
+
 
 @end

+ 4 - 0
RedAnt ERP Mobile/iSales-NPD/NotificationNameCenter.h

@@ -16,4 +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  *unLock_Order_List_Notification;///<Customer解锁Order List
+
 @end

+ 4 - 0
RedAnt ERP Mobile/iSales-NPD/NotificationNameCenter.m

@@ -16,4 +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  *unLock_Order_List_Notification = @"unLock_Order_List_Notification";
+
 @end

+ 9 - 0
RedAnt ERP Mobile/iSales-NPD/Singleton.m

@@ -7,6 +7,7 @@
 //
 
 #import "Singleton.h"
+#import "NotificationNameCenter.h"
 
 @implementation Singleton
 
@@ -19,5 +20,13 @@
     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];
+    } else {
+        [[NSNotificationCenter defaultCenter] postNotificationName:unLock_Order_List_Notification object:nil];
+    }
+}
 
 @end