Pen Li 9 anni fa
parent
commit
3fd0acadf6

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

@@ -1,25 +0,0 @@
-//
-//  NotificationNameCenter.h
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/9.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface NotificationNameCenter : NSObject
-
-UIKIT_EXTERN  NSString  *LoginOK_HandleUrgencyFile_Notification;///<登陆成功处理恢复文件
-
-UIKIT_EXTERN  NSString  *Change_Price_Type_Notification;///<切换价格通知
-
-UIKIT_EXTERN  NSString  *No_Rights_Notification;///<无权
-
-UIKIT_EXTERN  NSString  *Lock_Permission_Notification;///<Customer锁Order List
-
-UIKIT_EXTERN  NSString  *unLock_Permission_Notification;///<Customer解锁Order List
-
-UIKIT_EXTERN  NSString  *User_LoginOK_Notification;///<用户登陆成功
-
-@end

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

@@ -1,25 +0,0 @@
-//
-//  NotificationNameCenter.m
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/9.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "NotificationNameCenter.h"
-
-@implementation NotificationNameCenter
-
-const NSString  *LoginOK_HandleUrgencyFile_Notification = @"LoginOK_HandleUrgencyFile_Notification";
-
-const NSString  *Change_Price_Type_Notification = @"Change_Price_Type_Notification";
-
-const NSString  *No_Rights_Notification = @"No_Rights_Notification";
-
-const NSString  *Lock_Permission_Notification = @"Lock_Permission_Notification";
-
-const NSString  *unLock_Permission_Notification = @"unLock_Permission_Notification";
-
-const NSString  *User_LoginOK_Notification = @"User_LoginOK_Notification";
-
-@end

+ 0 - 16
RedAnt ERP Mobile/iSales-NPD/PriceSettingViewController.h

@@ -1,16 +0,0 @@
-//
-//  PriceSetting.h
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface PriceSettingViewController : UIViewController
-
-@property (nonatomic,assign) NSInteger priceType;///< 0提货价、1统一卖价、 2计算价
-@property (nonatomic,assign) BOOL showPrice;
-
-@end

+ 0 - 225
RedAnt ERP Mobile/iSales-NPD/PriceSettingViewController.m

@@ -1,225 +0,0 @@
-//
-//  PriceSetting.m
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "PriceSettingViewController.h"
-#import "const.h"
-#import "EnumSelectViewController.h"
-#import "CategoryPriceViewController.h"
-#import "iSalesNetwork.h"
-#import "Singleton.h"
-#import <objc/runtime.h>
-#import "MainViewController.h"
-#import "NotificationNameCenter.h"
-
-
-
-
-@interface PriceSettingViewController ()
-
-@property (strong, nonatomic) IBOutlet UIButton *priceTypeButton;
-
-@property (strong, nonatomic) IBOutlet UIButton *showButton;
-@property (strong, nonatomic) IBOutlet UIButton *setPriceButton;
-
-@end
-
-@implementation PriceSettingViewController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    
-    self.priceType = [Singleton sharedInstance].npd_shop_price_type;
-    
-    [self configAppearance];
-    
-}
-
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-
-#pragma mark - Customer Inint
-
-- (void)configAppearance {
-    
-
-    self.setPriceButton.hidden = ![Singleton sharedInstance].permissions_price_setting;
-
-    
-    UIApplication * app = [UIApplication sharedApplication];
-    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    
-    self.showPrice = !appDelegate.price_hidden;
-    
-    [self changePriceType:self.priceType];
-    self.showButton.selected = !self.showPrice;
-    
-    UIBarButtonItem *closeButton =   [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
-                                                                      style:UIBarButtonItemStylePlain
-                                                                     target:self
-                                                                     action:@selector(onCloseClick:)];
-    self.navigationItem.rightBarButtonItem = closeButton;
-    
-}
-
-- (void)changePriceType:(NSInteger)type {
-    
-    NSString *title = [Singleton sharedInstance].deliveryString;
-    switch (type) {
-        case 0: {
-            title = [Singleton sharedInstance].deliveryString;
-        }
-            break;
-        case 1: {
-            title = flat_price;
-        }
-            break;
-        case 2: {
-            title = given_price;
-        }
-            break;
-            
-        default:
-            break;
-    }
-    
-    self.priceType = type;
-    [self.priceTypeButton setTitle:title forState:UIControlStateNormal];
-    
-}
-
-#pragma mark - action
-
-- (void)onCloseClick:(id)sender {
-    [self dismissViewControllerAnimated:YES completion:^{
-        
-    }];
-}
-
-- (IBAction)showOrHidePriceButtonClick:(UIButton *)sender {
-    
-    sender.selected = !sender.selected;
-    self.showPrice = !sender.selected;
-    
-    UIApplication * app = [UIApplication sharedApplication];
-    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    
-    [appDelegate set_priceHidden:sender.selected];
-    
-//    objc_msgSend(appDelegate.main_vc,@selector(initMenuItems));// initMenuItems 不是公开的方法
-    [(MainViewController *)appDelegate.main_vc initMenuItems];
-}
-
-- (IBAction)calculatePriceButtonClick:(UIButton *)sender {
-
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Load Data"];
-    
-    NSDictionary *dic = [iSalesNetwork get_npd_shop_givenPrice];
-
-    [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-    
-    if ([[dic objectForKey:@"result"] integerValue] == 2) {
-    
-        CategoryPriceViewController *categoryPriceVC =[ [UIStoryboard storyboardWithName:@"CUL" bundle:nil] instantiateViewControllerWithIdentifier:@"CategoryPriceViewController"];
-        
-        categoryPriceVC.categoryGivenPrice = dic.mutableCopy;
-        
-        [self.navigationController pushViewController:categoryPriceVC animated:YES];
-    }
-}
-
-- (NSString *)checkPriceType:(NSInteger)priceType {
-    return  self.priceType == priceType ? @"1" : @"0";
-}
-
-- (NSInteger)checkedCadedate:(NSDictionary *)cadedate {
-    
-    int priceType = 0;
-    int count = [[cadedate objectForKey:@"count"] intValue];
-    for (int i = 0; i < count; i++) {
-        NSDictionary *dic = [cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
-        int check = [[dic objectForKey:@"check"] intValue];
-        if (check) {
-            
-            priceType = [[dic objectForKey:@"value_code"] integerValue];
-            
-            break;
-        }
-    }
-    
-    return priceType;
-}
-
-- (IBAction)priceTypeButtonClick:(UIButton *)sender {
-    
-    EnumSelectViewController* enumvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
-
-    enumvc.max_select = 1;
-    
-    
-//    enumvc.cadedate = @{
-//                        @"count" : @"3",
-//                        @"val_0" : @{@"value" : [Singleton sharedInstance].deliveryString,@"value_code" : @"0",@"check" : [self checkPriceType:0]},
-//                        @"val_1" : @{@"value" : flat_price,@"value_code" : @"1",@"check" : [self checkPriceType:1]},
-//                        @"val_2" : @{@"value" : given_price,@"value_code" : @"2",@"check" : [self checkPriceType:2]}
-//                        }.mutableCopy;
-    
-    enumvc.cadedate = @{
-                        @"count" : @"2",
-                        @"val_0" : @{@"value" : flat_price,@"value_code" : @"1",@"check" : [self checkPriceType:1]},
-                        @"val_1" : @{@"value" : given_price,@"value_code" : @"2",@"check" : [self checkPriceType:2]}
-                        }.mutableCopy;
-    
-    enumvc.title = @"";
-    
-    
-    enumvc.single_select =true;
-    
-    __weak typeof(self) weakSelf = self;
-    
-    enumvc.returnValue = ^(NSMutableDictionary* value){
-        
-        if (weakSelf) {
-            
-            __strong typeof(weakSelf) strongSelf = weakSelf;
-            
-            [strongSelf changePriceType:[strongSelf checkedCadedate:value]];
-
-        }
-        
-    };
-    
-    [self.navigationController pushViewController:enumvc animated:true];
-}
-
-- (IBAction)saveButtonClick:(UIButton *)sender {
-    
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Set PriceType"];
-    
-    NSDictionary *dic = [iSalesNetwork set_npd_shop_price_type:self.priceType];
-    
-    [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-    // 成功
-    if ([[dic objectForKey:@"result"] integerValue] == 2) {
-        
-        [Singleton sharedInstance].npd_shop_price_type = self.priceType;
-    
-        // 刷新 Cart、Order List
-        [[NSNotificationCenter defaultCenter] postNotificationName:Change_Price_Type_Notification object:nil];
-        
-    } else { // 失败
-        
-        DebugLog(@"set price type failure");
-    }
-    
-    [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-@end

+ 0 - 23
RedAnt ERP Mobile/iSales-NPD/SetCategoryPriceController.h

@@ -1,23 +0,0 @@
-//
-//  SetCategoryPriceController.h
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-
-
-typedef void (^setCategoryPriceReturnBlock) (NSDictionary *categoryPrice);
-
-@interface SetCategoryPriceController : UIViewController
-
-@property (nonatomic,assign) NSInteger categoryID;
-
-@property (nonatomic,strong) NSMutableDictionary *categoryPrice;
-
-@property (nonatomic,copy) setCategoryPriceReturnBlock returnBlock;
-
-@end

+ 0 - 325
RedAnt ERP Mobile/iSales-NPD/SetCategoryPriceController.m

@@ -1,325 +0,0 @@
-//
-//  SetCategoryPriceController.m
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/11.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "SetCategoryPriceController.h"
-#import "const.h"
-#import "EnumSelectViewController.h"
-#import "iSalesNetwork.h"
-
-#define Percent  100
-#define Float    101
-#define NoChange 102
-
-#define NUMBERS @"0123456789.\n"
-#define NEGATIVE_NUMBERS @"0123456789.-\n"
-
-
-@interface SetCategoryPriceController ()<UITextFieldDelegate>
-
-@property (strong, nonatomic) IBOutlet UIButton *basePriceButton;
-@property (strong, nonatomic) IBOutlet UIButton *floatCheckButton;
-@property (strong, nonatomic) IBOutlet UIButton *percentageCheckButton;
-@property (strong, nonatomic) IBOutlet UITextField *floatTextField;
-@property (strong, nonatomic) IBOutlet UITextField *percentageTextField;
-
-@property (nonatomic,assign) NSInteger changePrice;
-@property (nonatomic,assign) NSInteger priceType;
-
-@end
-
-@implementation SetCategoryPriceController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    
-    self.changePrice = NoChange;
-    self.basePriceButton.enabled = NO;
-    [self configAppearance];
-    
-}
-
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-
-- (void)configAppearance {
-    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
-                                                                   style:UIBarButtonItemStylePlain
-                                                                  target:self
-                                                                  action:@selector( returnBackClick:)];
-    
-    self.navigationItem.leftBarButtonItem = backButton;
-    
-    // base price
-//    NSString *basePrice = [self.categoryPrice objectForKey:@"base_price"];
-//    [self changePriceType:basePrice.integerValue];
-    [self changePriceType:1];
-    
-    // discount
-    NSString *discount = [self.categoryPrice objectForKey:@"price_discount"];
-    if ([discount hasSuffix:@"%"]) {
-        self.percentageTextField.text = [discount substringToIndex:discount.length - 1];
-    } else {
-        self.floatTextField.text = discount;
-    }
-
-}
-
-- (void)returnBackClick:(id)sender {
-    
-    [self.navigationController popViewControllerAnimated:YES];
-}
-
-- (void)changePriceType:(NSInteger)type {
-    
-    NSString *title = [Singleton sharedInstance].deliveryString;
-    switch (type) {
-        case 0: {
-            title = [Singleton sharedInstance].deliveryString;
-        }
-            break;
-        case 1: {
-            title = flat_price;
-        }
-            break;
-            
-        default:
-            break;
-    }
-    
-    self.priceType = type;
-    [self.basePriceButton setTitle:title forState:UIControlStateNormal];
-    
-}
-
-
-- (NSString *)checkPriceType:(NSInteger)priceType {
-    return  self.priceType == priceType ? @"1" : @"0";
-}
-
-- (NSInteger)checkedCadedate:(NSDictionary *)cadedate {
-    
-    int priceType = 0;
-    int count = [[cadedate objectForKey:@"count"] intValue];
-    for (int i = 0; i < count; i++) {
-        NSDictionary *dic = [cadedate objectForKey:[NSString stringWithFormat:@"val_%d",i]];
-        int check = [[dic objectForKey:@"check"] intValue];
-        if (check) {
-            
-            priceType = [[dic objectForKey:@"value_code"] integerValue];
-            
-            break;
-        }
-    }
-    
-    return priceType;
-}
-
-
-- (IBAction)basePriceButtonClick:(UIButton *)sender {
-    
-    EnumSelectViewController* enumvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"EnumSelectorViewController"];
-    
-    enumvc.max_select = 1;
-    
-    
-    enumvc.cadedate = @{
-                        @"count" : @"2",
-                        @"val_0" : @{@"value" : [Singleton sharedInstance].deliveryString,@"value_code" : @"0",@"check" : [self checkPriceType:0]},
-                        @"val_1" : @{@"value" : flat_price,@"value_code" : @"1",@"check" : [self checkPriceType:1]}
-                        }.mutableCopy;
-    enumvc.title = @"";
-    
-    
-    enumvc.single_select =true;
-    
-    __weak typeof(self) weakSelf = self;
-    
-    enumvc.returnValue = ^(NSMutableDictionary* value){
-        
-        if (weakSelf) {
-            __strong typeof(weakSelf) strongSelf = weakSelf;
-            [strongSelf changePriceType:[strongSelf checkedCadedate:value]];
-        }
-        
-    };
-    
-    [self.navigationController pushViewController:enumvc animated:true];
-}
-
-- (IBAction)percentageCheckButtonClick:(UIButton *)sender {
-    
-    
-    if (self.changePrice == NoChange || self.changePrice == Percent) {
-        sender.selected = !sender.selected;
-        if (sender.selected) {
-            self.changePrice = Percent;
-        } else {
-            self.changePrice = NoChange;
-        }
-    } else if (self.changePrice == Float) {
-        sender.selected = YES;
-        self.changePrice = Percent;
-        self.floatCheckButton.selected = NO;
-        self.floatTextField.enabled = NO;
-    }
-    
-    self.percentageTextField.enabled = sender.selected;
-    
-}
-
-- (IBAction)floatCheckButtonClick:(UIButton *)sender {
-    
-    if (self.changePrice == NoChange || self.changePrice == Float) {
-        sender.selected = !sender.selected;
-        if (sender.selected) {
-            self.changePrice = Float;
-        } else {
-            self.changePrice = NoChange;
-        }
-        
-    } else if (self.changePrice == Percent) {
-        sender.selected = YES;
-        self.changePrice = Float;
-        self.percentageCheckButton.selected = NO;
-        self.percentageTextField.enabled = NO;
-    }
-    self.floatTextField.enabled = sender.selected;
-}
-- (IBAction)saveButtonClick:(UIButton *)sender {
-    
-    // 向服务器提交数据
-    // http://192.168.0.126:8080/site/isales/setSeeGivenPrice.htm
-    
-    NSString *discount = @"";
-    BOOL rightDiscount = YES;
-    switch (self.changePrice) {
-        case Float:{
-            discount = self.floatTextField.text;
-            if (!discount || !discount.length) {
-                rightDiscount = NO;
-            }
-        }
-            break;
-        case Percent:{
-            discount = [self.percentageTextField.text stringByAppendingString:@"%"];
-            if (!discount || discount.length <= 1) {
-                rightDiscount = NO;
-            }
-        }
-            break;
-    
-        default:
-            break;
-    }
-    
-    
-    if (rightDiscount) {
-        
-        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Set Price"];
-        
-        NSDictionary *dic = [iSalesNetwork set_npd_shop_givenPrice:@{@"base_price" : [NSString stringWithFormat:@"%d",self.priceType],@"discount" : discount,@"category_id" : @(self.categoryID)}.mutableCopy];
-        
-        [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-        
-        if ([[dic objectForKey:@"result"] integerValue] == 2) {
-            
-            [self.categoryPrice setObject:[NSString stringWithFormat:@"%d",self.priceType] forKey:@"base_price"];
-            [self.categoryPrice setObject:discount forKey:@"price_discount"];
-            
-            // 将数据返回
-            if (self.returnBlock)
-                self.returnBlock(self.categoryPrice);
-        }
-        
-        [self.navigationController popViewControllerAnimated:YES];
-        
-    } else {
-        
-        [RAUtils message_alert:@"Please write a correct value" title:@"Warning" controller:self];
-        
-    }
-    
-}
-
-#pragma mark - text field delegate
-
-- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
-    
-    NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string];
-    
-    if (newText.length == 0)
-        return YES;
-
-//    // 第一个字符不能为小数点
-//    if ([newText isEqualToString:@"."])
-//        return NO;
-//    if ([newText componentsSeparatedByString:@"."].count > 2) {
-//        return NO;
-//    } // 不能有多个小数点
-//    
-//    // 只能第一个字符为减号
-//    if (newText.length > 1 && [string isEqualToString:@"-"]) {
-//        return NO;
-//    }
-//    // 不能为 0123
-//    if (newText.length > 1 && [newText hasPrefix:@"0"] && [newText characterAtIndex:1] != '.') {
-//        return NO;
-//    }
-//    // 不能为 -0123
-//    if (newText.length > 2 && [newText hasPrefix:@"-0"] && [newText characterAtIndex:2] != '.') {
-//        return NO;
-//    }
-//
-//    // 校验正数
-//    NSCharacterSet *cs;
-//    cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS]invertedSet];
-//    NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs]componentsJoinedByString:@""];
-//    BOOL canChange = [string isEqualToString:filtered];
-//    
-//    if ([textField isEqual:self.floatTextField]) {
-//
-//        // 校验负数
-//        NSCharacterSet *negative_cs;
-//        
-//        negative_cs = [[NSCharacterSet characterSetWithCharactersInString:NEGATIVE_NUMBERS]invertedSet];
-//        NSString *negative_filtered = [[string componentsSeparatedByCharactersInSet:negative_cs]componentsJoinedByString:@""];
-//        
-//        BOOL negative_canChange = [string isEqualToString:negative_filtered];
-//        
-//        // 只能第一个字符为减号
-//        if ([string isEqualToString:@"-"]) {
-//            
-//            if (newText.length == 1 && [string isEqualToString:@"-"]) {
-//                negative_canChange = YES && negative_canChange;
-//            } else {
-//                negative_canChange = NO;
-//            }
-//        }
-//
-//        
-//        return canChange || negative_canChange;
-//    } else {
-//        return canChange;
-//    }
-    
-
-    // 正则表达式
-    NSString *match = @"-[1-9]{1,1}[0-9]*(\\.[0-9]*)?|-0\\.[0-9]+|[1-9]{1,1}[0-9]*(\\.[0-9]*)?|0\\.[0-9]{0,}|0{1,1}|-{1,1}|-0{1,1}|-0\\.{1,1}";
-    
-    if ([textField isEqual:self.percentageTextField])
-        match = @"[1-9]{1,1}[0-9]*(\\.[0-9]*)?|0(\\.[0-9]*)?";
-    
-    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",match];
-    
-        return [predicate evaluateWithObject:newText];
-}
-
-@end

+ 0 - 48
RedAnt ERP Mobile/iSales-NPD/Singleton.h

@@ -1,48 +0,0 @@
-//
-//  Singleton.h
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/12.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <sqlite3.h>
-
-@interface Singleton : NSObject
-
-typedef enum {
-    Shop_Order = 0,
-    Sales_Order = 1
-}Customer_Oder_Type;
-
-@property (nonatomic,assign) sqlite3 *currentDB;///<当前打开的数据库
-
-#pragma mark - Customer
-
-@property (nonatomic,assign) BOOL permissions_price_setting;///<价格设置权限
-@property (nonatomic,assign) BOOL permissions_edit_order;///<编辑订单权限,Place Order
-@property (nonatomic,assign) BOOL permissions_submit_order;///<提交订单权限
-@property (nonatomic,assign) BOOL permissions_merge_order;///<合并订单权限
-@property (nonatomic,assign) NSInteger npd_shop_price_type;///<Shop设置的价格类型,0提货价、1统一卖价、 2计算价
-@property (nonatomic,  copy) NSString *deliveryString;///<登陆成功后接收的提货价名称
-// 使用枚举吗?Customer_Oder_Type
-@property (nonatomic,assign) NSInteger customer_order_type;///< 0 Shop Order/ 1 Sales Order,
-@property (nonatomic,assign) BOOL global_lock;///<全局锁,Yes表示订单不能查看Detail,需要密码验证Price Setting,Hide Price
-@property (nonatomic,assign) BOOL customer_can_see_sales_Order;///<是否有权查看Sales Order,控制Order List
-@property (nonatomic,strong) NSMutableDictionary *shop_order_status_filter;///<Shop Order Status
-@property (nonatomic,  copy) NSString *specialInstruction;///<登陆时传的Special Instruction,在提交订单时显示
-@property (nonatomic,assign) BOOL currentOrderIsMerged;///<当前打开的订单是否为Purchas Order
-@property (nonatomic,  copy) NSString *customer_email;///<Customer邮箱地址,登录时保存
-
-#pragma mark - Employee
-
-
-
-#pragma mark - Method
-
-+ (instancetype)sharedInstance;
-
-- (void)resetGlobalLock;
-
-@end

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

@@ -1,36 +0,0 @@
-//
-//  Singleton.m
-//  iSales-NPD
-//
-//  Created by Jack on 2016/10/12.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "Singleton.h"
-#import "NotificationNameCenter.h"
-
-@implementation Singleton
-
-+ (instancetype)sharedInstance {
-    static Singleton *singleton = nil;
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        singleton = [[Singleton alloc] init];
-    });
-    return singleton;
-}
-
-- (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_Permission_Notification object:nil];
-    }
-}
-
-- (void)resetGlobalLock {
-    _global_lock = YES;
-}
-
-@end

+ 0 - 19
RedAnt ERP Mobile/iSales-NPD/SortButton.h

@@ -1,19 +0,0 @@
-//
-//  SortButton.h
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/6.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface SortButton : UIControl
-
-@property (nonatomic,strong) UILabel *titleLabel;
-
-@property (nonatomic,strong) UIImageView *imageView;
-
-+ (SortButton*)sortButtonWithHeight:(CGFloat)height;
-
-@end

+ 0 - 73
RedAnt ERP Mobile/iSales-NPD/SortButton.m

@@ -1,73 +0,0 @@
-//
-//  SortButton.m
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/6.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "SortButton.h"
-
-@implementation SortButton
-
-- (instancetype)initWithFrame:(CGRect)frame {
-    if (self = [super initWithFrame:frame]) {
-        [self addSubview:self.titleLabel];
-        [self addSubview:self.imageView];
-    }
-    return self;
-}
-
-+ (SortButton*)sortButtonWithHeight:(CGFloat)height {
-    SortButton *btn = [[SortButton alloc] initWithFrame:CGRectMake(10, 0, 85, height)];
-    
-    return btn;
-}
-
-- (UILabel *)titleLabel {
-    if (!_titleLabel) {
-        CGSize size = [self string:@"sort by" sizeWithSize:CGSizeMake(60, 22) font:[UIFont systemFontOfSize:17]];
-        CGFloat h = CGRectGetHeight(self.bounds);
-        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, (h - size.height) / 2, size.width, size.height)];
-        _titleLabel.font = [UIFont systemFontOfSize:17];
-        _titleLabel.textColor = [UIColor blackColor];
-        _titleLabel.text = @"Sort By";
-        [_titleLabel sizeToFit];
-        
-    }
-    return _titleLabel;
-}
-
-- (UIImageView *)imageView {
-    if (!_imageView) {
-        CGFloat h = CGRectGetHeight(self.bounds);
-        CGFloat x = CGRectGetMaxX(self.titleLabel.frame) + 5;
-        CGFloat y = (h - 22) / 2;
-        
-        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, 22, 22)];
-        _imageView.image = [UIImage imageNamed:@"DX_22"];
-        
-        _imageView.userInteractionEnabled = YES;
-        
-        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImageView:)];
-        [_imageView addGestureRecognizer:tap];
-    }
-    return _imageView;
-}
-
--(CGSize)string:(NSString *)string sizeWithSize:(CGSize)size font:(UIFont *)font{
-    NSDictionary *attribute = @{NSFontAttributeName: font};
-    
-    CGSize resSize = [string boundingRectWithSize:size
-                                        options:(NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading)
-                                     attributes:attribute
-                                        context:nil].size;
-    
-    return resSize;
-}
-
-- (void)clickImageView:(id)recognizer {
-    [self sendActionsForControlEvents:UIControlEventTouchUpInside];
-}
-
-@end

+ 0 - 23
RedAnt ERP Mobile/iSales-NPD/SortItemCell.h

@@ -1,23 +0,0 @@
-//
-//  SortItemCell.h
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/5.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-#define CellIdentifier @"sortItemCell"
-
-@interface SortItemCell : UITableViewCell
-
-@property (nonatomic,strong) UILabel *sortTitleLabel;
-
-@property (nonatomic,copy) NSString *sortTitle;
-
-@property (nonatomic,assign) BOOL selectedSort;
-
-@property (nonatomic,assign) NSInteger sortIndex;
-
-@end

+ 0 - 122
RedAnt ERP Mobile/iSales-NPD/SortItemCell.m

@@ -1,122 +0,0 @@
-//
-//  SortItemCell.m
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/5.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "SortItemCell.h"
-
-
-@interface SortItemCell ()
-
-@property (nonatomic,strong) UIButton *selectedView;
-
-@end
-
-@implementation SortItemCell
-
-- (void)awakeFromNib {
-    [super awakeFromNib];
-    // Initialization code
-}
-
-- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
-    [super setSelected:selected animated:animated];
-
-    // Configure the view for the selected state
-}
-
-- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
-    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
-        
-        [self addSubview:self.selectedView];
-        [self addSubview:self.sortTitleLabel];
-        self.sortIndex = YES;
-    }
-    return self;
-}
-
-- (void)setFrame:(CGRect)frame {
-    [super setFrame:frame];
-    CGFloat w = CGRectGetWidth(frame);
-    CGFloat h = CGRectGetHeight(frame);
-    
-    self.sortTitleLabel.frame = CGRectMake(40, 0, w - 15, h);
-    self.selectedView.frame = CGRectMake(10, (h - 18) / 2, 18, 18);
-}
-
-- (UILabel *)sortTitleLabel {
-    if (!_sortTitleLabel) {
-        CGFloat w = CGRectGetWidth(self.bounds);
-        CGFloat h = CGRectGetHeight(self.bounds);
-        
-        _sortTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, w - 15, h)];
-        _sortTitleLabel.backgroundColor = [UIColor clearColor];
-        _sortTitleLabel.font = [UIFont systemFontOfSize:17];
-        _sortTitleLabel.textColor = [UIColor blackColor];
-        _sortTitleLabel.textAlignment = NSTextAlignmentLeft;
-        
-    }
-    return _sortTitleLabel;
-}
-
-- (UIButton *)selectedView {
-    if (!_selectedView) {
-
-        CGFloat h = CGRectGetHeight(self.bounds);
-        _selectedView = [[UIButton alloc] initWithFrame:CGRectMake(10, (h - 18) / 2, 18, 18)];
-        
-        _selectedView.userInteractionEnabled = NO;
-    }
-    return _selectedView;
-}
-
-- (void)setSortTitle:(NSString *)sortTitle {
-    _sortTitle = sortTitle;
-    
-    self.sortTitleLabel.text = sortTitle;
-   
-}
-
-- (void)setSelectedSort:(BOOL)selectedSort {
-    _selectedSort = selectedSort;
-
-    self.selectedView.selected = selectedSort;
-}
-
-- (void)setSortIndex:(NSInteger)sortIndex {
-    _sortIndex = sortIndex;
-    
-    NSString *selectedImageName = @"";
-    switch (sortIndex) {
-        case 0:{
-            selectedImageName = @"TX_18";
-        }
-            break;
-        case 1:{
-            selectedImageName = @"TS_18";
-        }
-            break;
-        case 2:{
-            selectedImageName = @"IX_18";
-        }
-            break;
-        case 3:{
-            selectedImageName = @"IS_18";
-        }
-            break;
-        case 4:{
-            selectedImageName = @"DX_18";
-        }
-            break;
-            
-        default:
-            break;
-    }
-    [self.selectedView setImage:[UIImage imageNamed:selectedImageName] forState:UIControlStateSelected];
-}
-
-
-@end

+ 0 - 21
RedAnt ERP Mobile/iSales-NPD/SortItemViewController.h

@@ -1,21 +0,0 @@
-//
-//  SortItemViewController.h
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/5.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-typedef void(^sortRequestBlock)(int sort);
-
-@interface SortItemViewController : UIViewController
-
-@property (nonatomic,copy) sortRequestBlock sortBlock;
-
-@property (nonatomic,assign) int sortIndex;
-
-- (instancetype)initWithTableOrigin:(CGPoint)origin;
-
-@end

+ 0 - 157
RedAnt ERP Mobile/iSales-NPD/SortItemViewController.m

@@ -1,157 +0,0 @@
-//
-//  SortItemViewController.m
-//  iSales-NPD
-//
-//  Created by Jack on 16/9/5.
-//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
-//
-
-#import "SortItemViewController.h"
-#import "SortItemCell.h"
-
-@interface SortItemViewController ()<UITableViewDelegate,UITableViewDataSource>
-{
-    CGSize tableSize;
-    CGPoint tableOrigin;
-}
-@property (nonatomic,strong) UITableView *sortTable;
-
-@property (nonatomic,strong) UIView *tableBackgroundView;
-
-@end
-
-@implementation SortItemViewController
-
-- (instancetype)initWithTableOrigin:(CGPoint)origin {
-    if (self = [super init]) {
-        tableOrigin = origin;
-    }
-    return self;
-}
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    tableSize = CGSizeMake(180, 200);
-    self.view.backgroundColor = [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.5];
-    
-    [self.view addSubview:self.tableBackgroundView];
-    
-}
-
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
-}
-
-#pragma mark - view
-
-- (UIView *)tableBackgroundView {
-    if (!_tableBackgroundView) {
-        
-        _tableBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(tableOrigin.x, tableOrigin.y, tableSize.width, tableSize.height + 20)];
-        _tableBackgroundView.layer.cornerRadius = 5;
-        _tableBackgroundView.layer.masksToBounds = YES;
-        _tableBackgroundView.backgroundColor = [UIColor whiteColor];
-        
-        [_tableBackgroundView addSubview:self.sortTable];
-        
-    }
-    return _tableBackgroundView;
-}
-
-- (UITableView *)sortTable {
-    if (!_sortTable) {
-        _sortTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, tableSize.width, tableSize.height) style:UITableViewStylePlain];
-        _sortTable.backgroundColor = [UIColor whiteColor];
-        _sortTable.showsVerticalScrollIndicator = NO;
-        _sortTable.showsHorizontalScrollIndicator = NO;
-        _sortTable.dataSource = self;
-        _sortTable.delegate = self;
-    }
-    return _sortTable;
-}
-
-#pragma mark data source
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return 5;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    SortItemCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
-    if (!cell) {
-        cell = [[SortItemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
-    }
-//    cell.selectionStyle = UITableViewCellSelectionStyleNone;
-    
-    switch (indexPath.row) {
-        case 0:{
-            cell.sortTitle = @"Last";
-        }
-            break;
-        case 1:{
-            cell.sortTitle = @"First";
-        }
-            break;
-        case 2:{
-            cell.sortTitle = @"Item number a-z";
-        }
-            break;
-        case 3:{
-            cell.sortTitle = @"Item number z-a";
-        }
-            break;
-        case 4:{
-            cell.sortTitle = @"Description";
-        }
-            break;
-            
-        default:
-            break;
-    }
-    cell.sortIndex = indexPath.row;
-    
-//    if (self.sortIndex == indexPath.row) {
-        cell.selectedSort = YES;
-//    }
-    
-    return cell;
-}
-
-#pragma mark delegate
-
-- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-    return 40;
-}
-
-- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    
-    SortItemCell *cell = [tableView cellForRowAtIndexPath:indexPath];
-    cell.selected = NO;
-    
-//    dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 0.25 * NSEC_PER_SEC);
-//    dispatch_after(time, dispatch_get_main_queue(), ^{
-//       
-//    });
-
-//    if (indexPath.row != self.sortIndex) {
-//        NSIndexPath *oldIndexPath = [NSIndexPath indexPathForRow:self.sortIndex inSection:0];
-//        SortItemCell *oldCell = [tableView cellForRowAtIndexPath:oldIndexPath];
-//        oldCell.selectedSort = NO;
-        
-        self.sortIndex = indexPath.row;
-        cell.selectedSort = YES;
-        
-        if (self.sortBlock) {
-            self.sortBlock(self.sortIndex);
-        }
-        
-//    }
-    
-    [self.view removeFromSuperview];
-    
-}
-
-
-@end