Commit 0c02d72c authored by 陈俊俊's avatar 陈俊俊

采购单

parent 31915bb2
...@@ -75,8 +75,8 @@ ...@@ -75,8 +75,8 @@
7217E9F41B72364300FE5C1D /* SurveyListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E31B72364300FE5C1D /* SurveyListCell.m */; }; 7217E9F41B72364300FE5C1D /* SurveyListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E31B72364300FE5C1D /* SurveyListCell.m */; };
7217E9F61B724A7600FE5C1D /* mask.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9F51B724A7600FE5C1D /* mask.png */; }; 7217E9F61B724A7600FE5C1D /* mask.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9F51B724A7600FE5C1D /* mask.png */; };
7281A0B31B8974120052B1AC /* NewPurchaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */; }; 7281A0B31B8974120052B1AC /* NewPurchaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */; };
7281A0B41B8974120052B1AC /* ProductViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0AC1B8974120052B1AC /* ProductViewController.m */; }; 7281A0B41B8974120052B1AC /* ProductBillViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0AC1B8974120052B1AC /* ProductBillViewController.m */; };
7281A0B51B8974120052B1AC /* ProductCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B01B8974120052B1AC /* ProductCell.m */; }; 7281A0B51B8974120052B1AC /* ProductBillCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B01B8974120052B1AC /* ProductBillCell.m */; };
7281A0B61B8974120052B1AC /* TopPurchaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B21B8974120052B1AC /* TopPurchaseView.m */; }; 7281A0B61B8974120052B1AC /* TopPurchaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B21B8974120052B1AC /* TopPurchaseView.m */; };
7281A0B91B897BB20052B1AC /* PurchaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B81B897BB20052B1AC /* PurchaseViewController.m */; }; 7281A0B91B897BB20052B1AC /* PurchaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B81B897BB20052B1AC /* PurchaseViewController.m */; };
7281A0BC1B897EAB0052B1AC /* PurchaseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0BB1B897EAB0052B1AC /* PurchaseCell.m */; }; 7281A0BC1B897EAB0052B1AC /* PurchaseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0BB1B897EAB0052B1AC /* PurchaseCell.m */; };
...@@ -499,10 +499,10 @@ ...@@ -499,10 +499,10 @@
7217E9F51B724A7600FE5C1D /* mask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mask.png; sourceTree = "<group>"; }; 7217E9F51B724A7600FE5C1D /* mask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mask.png; sourceTree = "<group>"; };
7281A0A91B8974120052B1AC /* NewPurchaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewPurchaseViewController.h; sourceTree = "<group>"; }; 7281A0A91B8974120052B1AC /* NewPurchaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewPurchaseViewController.h; sourceTree = "<group>"; };
7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewPurchaseViewController.m; sourceTree = "<group>"; }; 7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewPurchaseViewController.m; sourceTree = "<group>"; };
7281A0AB1B8974120052B1AC /* ProductViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductViewController.h; sourceTree = "<group>"; }; 7281A0AB1B8974120052B1AC /* ProductBillViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductBillViewController.h; sourceTree = "<group>"; };
7281A0AC1B8974120052B1AC /* ProductViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductViewController.m; sourceTree = "<group>"; }; 7281A0AC1B8974120052B1AC /* ProductBillViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductBillViewController.m; sourceTree = "<group>"; };
7281A0AF1B8974120052B1AC /* ProductCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductCell.h; sourceTree = "<group>"; }; 7281A0AF1B8974120052B1AC /* ProductBillCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductBillCell.h; sourceTree = "<group>"; };
7281A0B01B8974120052B1AC /* ProductCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductCell.m; sourceTree = "<group>"; }; 7281A0B01B8974120052B1AC /* ProductBillCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductBillCell.m; sourceTree = "<group>"; };
7281A0B11B8974120052B1AC /* TopPurchaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopPurchaseView.h; sourceTree = "<group>"; }; 7281A0B11B8974120052B1AC /* TopPurchaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopPurchaseView.h; sourceTree = "<group>"; };
7281A0B21B8974120052B1AC /* TopPurchaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopPurchaseView.m; sourceTree = "<group>"; }; 7281A0B21B8974120052B1AC /* TopPurchaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopPurchaseView.m; sourceTree = "<group>"; };
7281A0B71B897BB20052B1AC /* PurchaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseViewController.h; sourceTree = "<group>"; }; 7281A0B71B897BB20052B1AC /* PurchaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseViewController.h; sourceTree = "<group>"; };
...@@ -1057,8 +1057,8 @@ ...@@ -1057,8 +1057,8 @@
children = ( children = (
7281A0A91B8974120052B1AC /* NewPurchaseViewController.h */, 7281A0A91B8974120052B1AC /* NewPurchaseViewController.h */,
7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */, 7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */,
7281A0AB1B8974120052B1AC /* ProductViewController.h */, 7281A0AB1B8974120052B1AC /* ProductBillViewController.h */,
7281A0AC1B8974120052B1AC /* ProductViewController.m */, 7281A0AC1B8974120052B1AC /* ProductBillViewController.m */,
7281A0B71B897BB20052B1AC /* PurchaseViewController.h */, 7281A0B71B897BB20052B1AC /* PurchaseViewController.h */,
7281A0B81B897BB20052B1AC /* PurchaseViewController.m */, 7281A0B81B897BB20052B1AC /* PurchaseViewController.m */,
7281A0C01B898A040052B1AC /* PurchaseDetailViewController.h */, 7281A0C01B898A040052B1AC /* PurchaseDetailViewController.h */,
...@@ -1093,8 +1093,8 @@ ...@@ -1093,8 +1093,8 @@
7281A0AE1B8974120052B1AC /* Views */ = { 7281A0AE1B8974120052B1AC /* Views */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
7281A0AF1B8974120052B1AC /* ProductCell.h */, 7281A0AF1B8974120052B1AC /* ProductBillCell.h */,
7281A0B01B8974120052B1AC /* ProductCell.m */, 7281A0B01B8974120052B1AC /* ProductBillCell.m */,
7281A0B11B8974120052B1AC /* TopPurchaseView.h */, 7281A0B11B8974120052B1AC /* TopPurchaseView.h */,
7281A0B21B8974120052B1AC /* TopPurchaseView.m */, 7281A0B21B8974120052B1AC /* TopPurchaseView.m */,
7281A0BA1B897EAB0052B1AC /* PurchaseCell.h */, 7281A0BA1B897EAB0052B1AC /* PurchaseCell.h */,
...@@ -2329,7 +2329,7 @@ ...@@ -2329,7 +2329,7 @@
7217E9E81B72364300FE5C1D /* Survey.m in Sources */, 7217E9E81B72364300FE5C1D /* Survey.m in Sources */,
FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */, FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */,
FE4678AD1B8D636300B5EDA3 /* ChooseWarehouseViewController.m in Sources */, FE4678AD1B8D636300B5EDA3 /* ChooseWarehouseViewController.m in Sources */,
7281A0B51B8974120052B1AC /* ProductCell.m in Sources */, 7281A0B51B8974120052B1AC /* ProductBillCell.m in Sources */,
C1FE50561AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */, C1FE50561AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */,
30D7494C1ACE340D00C63BA1 /* ICRModifyPwdViewController.m in Sources */, 30D7494C1ACE340D00C63BA1 /* ICRModifyPwdViewController.m in Sources */,
C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */, C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */,
...@@ -2377,7 +2377,7 @@ ...@@ -2377,7 +2377,7 @@
FE2FCC7F1B74511000BBC6FB /* ChooseProductViewController.m in Sources */, FE2FCC7F1B74511000BBC6FB /* ChooseProductViewController.m in Sources */,
351CFF5E1B90633700F30866 /* GXFNoticeFunctionTableViewCell.m in Sources */, 351CFF5E1B90633700F30866 /* GXFNoticeFunctionTableViewCell.m in Sources */,
FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */, FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */,
7281A0B41B8974120052B1AC /* ProductViewController.m in Sources */, 7281A0B41B8974120052B1AC /* ProductBillViewController.m in Sources */,
72EDD86E1B96E11700964115 /* ChooseParentViewController.m in Sources */, 72EDD86E1B96E11700964115 /* ChooseParentViewController.m in Sources */,
C159183D1AC062460013B391 /* IBTTableViewCellInfo.m in Sources */, C159183D1AC062460013B391 /* IBTTableViewCellInfo.m in Sources */,
C1FE504E1AE024FA00C18080 /* RIButtonItem.m in Sources */, C1FE504E1AE024FA00C18080 /* RIButtonItem.m in Sources */,
......
...@@ -235,8 +235,21 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -235,8 +235,21 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
- (void)savePurchaseWithData:(id)data - (void)savePurchaseWithData:(id)data
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//获取采购单列表
- (void)queryPurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//获取采购单详情
- (void)getPurchaseResultWithPurchaseUuid:(NSString *)purchaseUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//审核/拒绝/供应商确认/结束/作废采购单
- (void)dealByActionWithPurchaseUuid:(NSString *)purchaseUuid
action:(NSString *)action
remark:(NSString *)remark
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end @end
...@@ -79,7 +79,12 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -79,7 +79,12 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//供应商 //供应商
XFFHttp_GetVendor, XFFHttp_GetVendor,
//仓库 //仓库
XFFHttp_GetWarehouse XFFHttp_GetWarehouse,
//采购单
XFFHttp_PurchaseSave,
XFFHttp_QueryPurchase,
XFFHttp_GetPurchaseDetail,
XFFHttp_DealByActionPurchase
}; };
static NSString * const ICRHTTPInterface[] = { static NSString * const ICRHTTPInterface[] = {
...@@ -140,7 +145,11 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -140,7 +145,11 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_GetVendor] = @"data/vendor/download", [XFFHttp_GetVendor] = @"data/vendor/download",
//仓库 //仓库
[XFFHttp_GetWarehouse] = @"data/warehouse/download", [XFFHttp_GetWarehouse] = @"data/warehouse/download",
//采购单
[XFFHttp_PurchaseSave] = @"purchase/bill/save",
[XFFHttp_QueryPurchase] = @"purchase/bill/query",
[XFFHttp_GetPurchaseDetail] = @"purchase/bill/get",
[XFFHttp_DealByActionPurchase] = @"purchase/bill/action"
}; };
static NSString * const ICRAttachmentTypeValue[] = { static NSString * const ICRAttachmentTypeValue[] = {
...@@ -1736,7 +1745,7 @@ acceptTypeJson:YES ...@@ -1736,7 +1745,7 @@ acceptTypeJson:YES
NSDictionary *dict = data; NSDictionary *dict = data;
NSString *currentTime = [[NSDate date] httpParameterString]; NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_PurchaseSave] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr [self POST:encodeUrlStr
parameters:dict parameters:dict
...@@ -1745,6 +1754,101 @@ acceptTypeJson:YES ...@@ -1745,6 +1754,101 @@ acceptTypeJson:YES
success:success success:success
failure:failure]; failure:failure];
} }
//获取行情调研单列表
- (void)queryPurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *urlStr = [[self class] UrlForPluginHTTPAction:XFFHttp_QueryPurchase];
[self POST:urlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//获取采购单详情
- (void)getPurchaseResultWithPurchaseUuid:(NSString *)purchaseUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!purchaseUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetPurchaseDetail] stringByAppendingFormat:@"/%@",purchaseUuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
- (void)dealByActionWithPurchaseUuid:(NSString *)purchaseUuid
action:(NSString *)action
remark:(NSString *)remark
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!purchaseUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetPurchaseDetail] stringByAppendingFormat:@"/%@?action=%@&remark=%@&version=%@&time=%@&operId=%@&operName=%@",purchaseUuid,action,remark,version,[[NSDate date] httpParameterString],userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end @end
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#import "MaskCell.h" #import "MaskCell.h"
#import "MJRefresh.h" #import "MJRefresh.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseParentViewController : ICRBaseViewController @interface ChooseParentViewController : ICRBaseViewController
...@@ -23,7 +22,7 @@ ...@@ -23,7 +22,7 @@
@property (nonatomic,assign) BOOL isRefresh; @property (nonatomic,assign) BOOL isRefresh;
- (void)endRefreshing; - (void)endRefreshing;
- (void)getBaseDataFromLocal; - (void)getBaseDataFromServer;
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath; - (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath;
- (void)deleteTextFieldStr; - (void)deleteTextFieldStr;
@end @end
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
// //
#import "ChooseParentViewController.h" #import "ChooseParentViewController.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseParentViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate> @interface ChooseParentViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@end @end
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
return ; return ;
} }
self.isRefresh = YES; self.isRefresh = YES;
[self getBaseDataFromLocal]; [self getBaseDataFromServer];
}]; }];
} }
...@@ -111,7 +112,7 @@ ...@@ -111,7 +112,7 @@
} }
#pragma mark -childFunction #pragma mark -childFunction
-(void)getBaseDataFromLocal -(void)getBaseDataFromServer
{ {
} }
- (void)sureClick - (void)sureClick
......
...@@ -104,15 +104,21 @@ ...@@ -104,15 +104,21 @@
#define GXF_DETAIL_COLOR HexColor(@"888888") #define GXF_DETAIL_COLOR HexColor(@"888888")
#define GXF_LEFTSIX_COLOR HexColor(@"666666") #define GXF_LEFTSIX_COLOR HexColor(@"666666")
#define GXF_THREETEENTH_SIZE FontSize(13)
#define GXF_FOURTEENTH_SIZE FontSize(14) #define GXF_FOURTEENTH_SIZE FontSize(14)
#define GXF_FIFTEENTEN_SIZE FontSize(15) #define GXF_FIFTEENTEN_SIZE FontSize(15)
#define GXF_SIXTEENTEH_SIZE FontSize(16) #define GXF_SIXTEENTEH_SIZE FontSize(16)
#define GXF_SEVENTEENTH_SIZE FontSize(17) #define GXF_SEVENTEENTH_SIZE FontSize(17)
//refreshUpdateDate //refreshUpdateDate
#define SurveyUpdateDate @"surveyUpdateDate" #define SurveyUpdateDate @"surveyUpdateDate"
#define ChooseProductUpdateDate @"chooseProductUpdateDate" #define ChooseProductUpdateDate @"chooseProductUpdateDate"
#define ChoosePersonUpdateDate @"choosePersonUpdateDate" #define ChoosePersonUpdateDate @"choosePersonUpdateDate"
#define ChooseVendorUpdateDate @"chooseVendorUpdateDate"
#define ChooseWarehouseUpdateDate @"chooseWarehouseUpdateDate"
#define PurchaseUpdateDate @"purchaseUpdateDate"
//行情调研状态 //行情调研状态
//initial(未提交),submitted(已提交),insurvey(调研中),finished(已完成) //initial(未提交),submitted(已提交),insurvey(调研中),finished(已完成)
#define SURVEY_STATE_INITIAL @"initial" #define SURVEY_STATE_INITIAL @"initial"
...@@ -132,6 +138,8 @@ ...@@ -132,6 +138,8 @@
#define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show] #define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show]
//类型
#define GXF_Critical @"critical"//紧急
#define GXF_Normal @"normal"//普通
#endif #endif
...@@ -6,10 +6,9 @@ ...@@ -6,10 +6,9 @@
// Copyright (c) 2015年 Xummer. All rights reserved. // Copyright (c) 2015年 Xummer. All rights reserved.
// //
#import "ICRBaseViewController.h" #import "ChooseParentViewController.h"
typedef void(^ChoseType)(NSString *type); typedef void(^ChoseType)(NSString *type);
@interface ChooseTypeViewController : ICRBaseViewController @interface ChooseTypeViewController : ChooseParentViewController
@property (nonatomic,copy)ChoseType choseType; @property (nonatomic,copy)ChoseType choseType;
@property (nonatomic,copy)NSArray *dataArr;
@end @end
...@@ -7,82 +7,37 @@ ...@@ -7,82 +7,37 @@
// //
#import "ChooseTypeViewController.h" #import "ChooseTypeViewController.h"
#import "MaskCell.h"
#define TopMargin 50 #define TopMargin 50
#define TableHeight 50 #define TableHeight 50
@interface ChooseTypeViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate> @interface ChooseTypeViewController ()
{ {
UITextField *_selectTextFiled;
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
} }
@property (nonatomic,strong)UITableView *tableView;
@end @end
@implementation ChooseTypeViewController @implementation ChooseTypeViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self bulidLayout]; self.title = @"类型";
[self.dataArr addObject:@"紧急"];
[self.dataArr addObject:@"普通"];
} }
- (void)bulidLayout - (void)createRefresh{}
{
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = GXF_FIFTEENTEN_SIZE;
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)sureClick{ - (void)sureClick{
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
if (_currentIndexPath) { if (_currentIndexPath) {
NSString *type = self.dataArr[_currentIndexPath.row]; NSString *type = self.dataArr[_currentIndexPath.row];
self.choseType(type); self.choseType(type);
} }
} }
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} }
- (void)deletePerson {
_selectTextFiled.text = @"";
_currentIndexPath = nil;
[self.tableView reloadData];
}
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskCell"; static NSString *cellID = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
...@@ -105,7 +60,6 @@ ...@@ -105,7 +60,6 @@
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
NSString *type = self.dataArr[indexPath.row]; NSString *type = self.dataArr[indexPath.row];
[cell setTitleStr:type]; [cell setTitleStr:type];
} }
return cell; return cell;
} }
...@@ -118,15 +72,8 @@ ...@@ -118,15 +72,8 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath]; MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath; _currentIndexPath = indexPath;
NSString *type = self.dataArr[indexPath.row];
_selectTextFiled.text = type;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -6,10 +6,9 @@ ...@@ -6,10 +6,9 @@
// Copyright (c) 2015年 Xummer. All rights reserved. // Copyright (c) 2015年 Xummer. All rights reserved.
// //
#import "ICRBaseViewController.h" #import "ChooseParentViewController.h"
typedef void(^ChoseVendor)(NSArray *vendor); typedef void(^ChoseVendor)(NSArray *vendor);
@interface ChooseVendorViewController : ICRBaseViewController @interface ChooseVendorViewController : ChooseParentViewController
@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
@property (nonatomic,copy)ChoseVendor choseVendor; @property (nonatomic,copy)ChoseVendor choseVendor;
@end @end
...@@ -7,44 +7,40 @@ ...@@ -7,44 +7,40 @@
// //
#import "ChooseVendorViewController.h" #import "ChooseVendorViewController.h"
#import "MaskCell.h"
#import "Vendor.h" #import "Vendor.h"
#define TopMargin 50 #define TopMargin 50
#define TableHeight 50 #define TableHeight 50
@interface ChooseVendorViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate> @interface ChooseVendorViewController ()
{ {
UITextField *_selectTextFiled;
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
} }
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *indexArr;
@end @end
@implementation ChooseVendorViewController @implementation ChooseVendorViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self initData]; //记录更新时间
[self bulidLayout]; self.tableView.header.lastUpdatedTimeKey = ChooseVendorUpdateDate;
} self.title = @"选择供应商";
- (void)initData{ [self fetchVendorList:@""];
self.dataArr = [NSMutableArray array];
self.indexArr = [NSMutableArray array];
[self fetchVendorList];
}
- (void)getBaseDataFromServer{
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
if (data) { if (data) {
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchVendorList]; [strongSelf endRefreshing];
[strongSelf fetchVendorList:@""];
}else{ }else{
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
} }
}; };
void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
...@@ -54,63 +50,38 @@ ...@@ -54,63 +50,38 @@
} }
#pragma mark -成功 #pragma mark -成功
- (void)fetchVendorList{ - (void)fetchVendorList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) { ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Vendor TableName], @"uuid"]; NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [Vendor TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Vendor TableName], @"uuid"];
}
return [db executeQuery:sql]; return [db executeQuery:sql];
}; };
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) { ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects]; if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseVendorUpdateDate]) {
[strongSelf.tableView reloadData]; [GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseVendorUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
}; };
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController]; ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[Vendor class] [dbCtrl runFetchForClass:[Vendor class]
fetchBlock:fetchBlk fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk]; fetchResultsBlock:fetchResultsBlk];
} }
#pragma mark - 插入数据
- (void)bulidLayout
{
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = GXF_FIFTEENTEN_SIZE;
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)sureClick{ - (void)sureClick{
if (self.isMoreChose) { if (self.isMoreChose) {
NSMutableArray *arr = [[NSMutableArray alloc]init]; NSMutableArray *arr = [[NSMutableArray alloc]init];
...@@ -132,24 +103,12 @@ ...@@ -132,24 +103,12 @@
} }
- (void)deletePerson { - (void)deleteTextFieldStr {
if (self.isMoreChose) { [super deleteTextFieldStr];
[self.indexArr removeAllObjects]; [self boxValueChanged:nil];
}else{
_currentIndexPath = nil;
}
_selectTextFiled.text = @"";
[self.tableView reloadData];
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskCell"; static NSString *cellID = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
...@@ -177,15 +136,24 @@ ...@@ -177,15 +136,24 @@
} }
} }
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
Vendor *vendor = self.dataArr[indexPath.row]; if (indexPath.row == 0) {
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code]; NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
[cell setTitleStr:proStr]; cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Vendor *vendor = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
[cell setTitleStr:proStr];
}
} }
return cell; return cell;
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
return;
}
if (self.isMoreChose == YES) { if (self.isMoreChose == YES) {
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath]; MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
...@@ -193,45 +161,28 @@ ...@@ -193,45 +161,28 @@
[self.indexArr addObject:indexPath]; [self.indexArr addObject:indexPath];
} }
NSString *personStr = @""; }else{
for (NSIndexPath *index in self.indexArr) {
Vendor *vendor = self.dataArr[index.row];
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",vendor.name];
}else{
personStr = [personStr stringByAppendingFormat:@"、%@",vendor.name];
}
}
_selectTextFiled.text = personStr;
}else{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath]; MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES; currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath]; MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath; _currentIndexPath = indexPath;
Vendor *vendor = self.dataArr[indexPath.row];
_selectTextFiled.text = vendor.name;
} }
} }
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{ #pragma mark - 按钮事件
for (NSIndexPath *path in self.indexArr) { - (void)boxValueChanged:(NSNotification *)fication{
if (path.row == indexPath.row) { NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
return YES; [self fetchVendorList:tilkeStr];
}
}
return NO;
} }
- (void)tableViewRefresh{
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ _currentIndexPath = nil;
return TableHeight; if (self.indexArr.count > 0) {
[self.indexArr removeAllObjects];
}
[self.tableView reloadData];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
// Copyright (c) 2015年 Xummer. All rights reserved. // Copyright (c) 2015年 Xummer. All rights reserved.
// //
#import "ICRBaseViewController.h" #import "ChooseParentViewController.h"
#import "Warehouse.h" #import "Warehouse.h"
typedef void(^ChoseWarehouse)(Warehouse *warehouse); typedef void(^ChoseWarehouse)(Warehouse *warehouse);
@interface ChooseWarehouseViewController : ICRBaseViewController @interface ChooseWarehouseViewController : ChooseParentViewController
@property (nonatomic,copy)ChoseWarehouse choseWarehouse; @property (nonatomic,copy)ChoseWarehouse choseWarehouse;
@end @end
...@@ -7,42 +7,37 @@ ...@@ -7,42 +7,37 @@
// //
#import "ChooseWarehouseViewController.h" #import "ChooseWarehouseViewController.h"
#import "MaskCell.h"
#define TopMargin 50 #define TopMargin 50
#define TableHeight 50 #define TableHeight 50
@interface ChooseWarehouseViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate> @interface ChooseWarehouseViewController ()
{ {
UITextField *_selectTextFiled;
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
} }
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@end @end
@implementation ChooseWarehouseViewController @implementation ChooseWarehouseViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self initData]; //记录更新时间
[self bulidLayout]; self.tableView.header.lastUpdatedTimeKey = ChooseWarehouseUpdateDate;
self.title = @"选择仓库";
[self fetchWarehouseList:@""];
} }
- (void)initData{
self.dataArr = [NSMutableArray array]; - (void)getBaseDataFromServer{
[self fetchWarehouseList];
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
if (data) { if (data) {
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchWarehouseList]; [self endRefreshing];
[strongSelf fetchWarehouseList:@""];
}else{ }else{
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
} }
}; };
void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
...@@ -53,18 +48,31 @@ ...@@ -53,18 +48,31 @@
} }
#pragma mark -成功 #pragma mark -成功
- (void)fetchWarehouseList{ - (void)fetchWarehouseList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) { ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Warehouse TableName], @"uuid"]; NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [Warehouse TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Warehouse TableName], @"uuid"];
}
return [db executeQuery:sql]; return [db executeQuery:sql];
}; };
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) { ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf.dataArr removeAllObjects]; if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseWarehouseUpdateDate]) {
[strongSelf.dataArr addObjectsFromArray:fetchedObjects]; [GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseWarehouseUpdateDate];
[strongSelf.tableView reloadData]; [GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
}; };
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController]; ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
...@@ -72,40 +80,6 @@ ...@@ -72,40 +80,6 @@
fetchBlock:fetchBlk fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk]; fetchResultsBlock:fetchResultsBlk];
} }
- (void)bulidLayout
{
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = GXF_FIFTEENTEN_SIZE;
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)sureClick{ - (void)sureClick{
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
...@@ -118,19 +92,12 @@ ...@@ -118,19 +92,12 @@
} }
- (void)deletePerson { - (void)deleteTextFieldStr {
_selectTextFiled.text = @""; [super deleteTextFieldStr];
_currentIndexPath = nil;
[self.tableView reloadData];
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskCell"; static NSString *cellID = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
...@@ -151,11 +118,16 @@ ...@@ -151,11 +118,16 @@
cell.Commitbtn.hidden = YES; cell.Commitbtn.hidden = YES;
} }
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
Warehouse *warehouse = self.dataArr[indexPath.row]; if (indexPath.row == 0) {
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code]; NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:proStr]; [cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Warehouse *warehouse = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
[cell setTitleStr:proStr];
}
} }
return cell; return cell;
} }
...@@ -168,15 +140,21 @@ ...@@ -168,15 +140,21 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath]; MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath; _currentIndexPath = indexPath;
Warehouse *warehouse = self.dataArr[indexPath.row];
_selectTextFiled.text = warehouse.name;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ #pragma mark - 按钮事件
return TableHeight; - (void)boxValueChanged:(NSNotification *)fication{
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchWarehouseList:tilkeStr];
}
- (void)tableViewRefresh{
_currentIndexPath = nil;
if (self.indexArr.count > 0) {
[self.indexArr removeAllObjects];
}
[self.tableView reloadData];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
#import "PurchaseBill.h"
@interface NewPurchaseViewController : ICRBaseViewController @interface NewPurchaseViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *purchaseBill;
@end @end
...@@ -8,31 +8,29 @@ ...@@ -8,31 +8,29 @@
#import "NewPurchaseViewController.h" #import "NewPurchaseViewController.h"
#import "TopPurchaseView.h" #import "TopPurchaseView.h"
#import "ProductViewController.h" #import "ProductBillViewController.h"
#import "AddProductViewController.h" #import "AddProductViewController.h"
#import "PurchaseBillProduct.h" #import "PurchaseBillProduct.h"
#import "PurchaseViewController.h"
#define TopHeight 328 #define TopHeight 328
#define BottomHeight 300 #define BottomHeight 300
#define SpaceHeight 20 #define SpaceHeight 20
#define BottomViewHeight 60 #define BottomViewHeight 60
typedef enum : NSUInteger { typedef enum : NSUInteger {
SaveTag = 8000, SaveTag = 8000,
CommitTag, CommitTag,
} BtnTag; } BtnTag;
@interface NewPurchaseViewController ()<TopPurchaseViewDelegate,ProductViewDelegate> @interface NewPurchaseViewController ()<TopPurchaseViewDelegate>
{ {
UIScrollView *_scrollView; UIScrollView *_scrollView;
TopPurchaseView *_purchaseView; TopPurchaseView *_purchaseView;
UIView *_bottomView; UIView *_bottomView;
ProductViewController *_pvc ; ProductBillViewController *_pvc ;
AddProductViewController *_avc; id uuidObject;
id billNumberObject;
NSNumber *versionObject;
} }
@property (nonatomic,strong)NSNumber *total;
@property (nonatomic,strong)NSNumber *charge;
@property (nonatomic,strong)NSString *remark;
@property (nonatomic,strong)NSString *state; @property (nonatomic,strong)NSString *state;
@end @end
...@@ -52,6 +50,10 @@ typedef enum : NSUInteger { ...@@ -52,6 +50,10 @@ typedef enum : NSUInteger {
[super viewDidLoad]; [super viewDidLoad];
//布局 //布局
[self bulidLayout]; [self bulidLayout];
//数据默认值
uuidObject = [NSNull null];
billNumberObject = [NSNull null];
versionObject = [NSNumber numberWithInteger:0];
} }
...@@ -83,8 +85,7 @@ typedef enum : NSUInteger { ...@@ -83,8 +85,7 @@ typedef enum : NSUInteger {
_bottomView.backgroundColor = [UIColor whiteColor]; _bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView]; [_scrollView addSubview:_bottomView];
_pvc = [[ProductViewController alloc]init]; _pvc = [[ProductBillViewController alloc]init];
_pvc.delegate = self;
_pvc.viewFrame = _bottomView.bounds; _pvc.viewFrame = _bottomView.bounds;
[_bottomView addSubview:_pvc.view]; [_bottomView addSubview:_pvc.view];
...@@ -100,8 +101,8 @@ typedef enum : NSUInteger { ...@@ -100,8 +101,8 @@ typedef enum : NSUInteger {
totalPrice += [billProduct.total floatValue]; totalPrice += [billProduct.total floatValue];
} }
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.2f",totalPrice + otherPrice]; _purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.2f",totalPrice + otherPrice];
self.charge = [NSNumber numberWithFloat:otherPrice]; _purchaseView.chargePurchase = [NSNumber numberWithFloat:otherPrice];
self.total = [NSNumber numberWithFloat:totalPrice]; _purchaseView.total = [NSNumber numberWithFloat:totalPrice+otherPrice];
} }
- (void)btnClick:(UIButton *)btn{ - (void)btnClick:(UIButton *)btn{
...@@ -109,12 +110,15 @@ typedef enum : NSUInteger { ...@@ -109,12 +110,15 @@ typedef enum : NSUInteger {
case SaveTag: case SaveTag:
{ {
if ([self checkPurchase]) { if ([self checkPurchase]) {
[self getDataFromServer:PURCHASE_STATE_INITIAL msg:@"正在保存..."];
} }
} }
break; break;
case CommitTag:{ case CommitTag:{
if ([self checkPurchase]) {
[self getDataFromServer:PURCHASE_STATE_SUBMITTED msg:@"正在提交..."];
}
} }
break; break;
default: default:
...@@ -122,12 +126,92 @@ typedef enum : NSUInteger { ...@@ -122,12 +126,92 @@ typedef enum : NSUInteger {
} }
} }
- (void)getDataFromServer:(NSString *)state msg:(NSString *)msg{
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
if ([state isEqualToString:PURCHASE_STATE_INITIAL]) {//保存成功
NSString *uuidS = data[@"data"][@"uuid"];
NSString *billNumberS = data[@"data"][@"billNumber"];
NSNumber *versionN = data[@"data"][@"version"];
uuidObject = uuidS;
billNumberObject = billNumberS;
versionObject = versionN;
[IBTLoadingView showTips:[NSString stringWithFormat:@"当前单据%@已保存成功",billNumberS]];
}else{//提交成功
PurchaseViewController *svc = [PurchaseViewController new];
[self PushViewController:svc animated:YES];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
if(self.purchaseBill.uuid.length > 0 && uuidObject == [NSNull null]){
uuidObject = self.purchaseBill.uuid;
}
if (self.purchaseBill.billNumber > 0 && billNumberObject == [NSNull null]) {
billNumberObject = self.purchaseBill.billNumber;
}
if (self.purchaseBill && [versionObject integerValue] == 0) {
versionObject = self.purchaseBill.version;
}
NSMutableArray *billProducts = [NSMutableArray array];
for (PurchaseBillProduct *billProduct in _pvc.productArr) {
[billProducts addObject:[billProduct dictForCommit]];
}
NSDictionary *dict = @{@"uuid":uuidObject,
@"version":versionObject,
@"billnumber":billNumberObject,
@"state":state,
@"type":[IBTCommon checkString:_purchaseView.type],
@"noticeUuid":[IBTCommon checkString:_purchaseView.noticeUuid],
@"noticeNumber":[IBTCommon checkString:_purchaseView.noticeNumber],
@"vendor_uuid":[IBTCommon checkString:_purchaseView.vendor_uuid],
@"vendor_code":[IBTCommon checkString:_purchaseView.vendor_code],
@"vendor_name":[IBTCommon checkString:_purchaseView.vendor_name],
@"receiveWrh_uuid":[IBTCommon checkString:_purchaseView.receiveWrh_uuid],
@"receiveWrh_code":[IBTCommon checkString:_purchaseView.receiveWrh_code],
@"receiveWrh_name":[IBTCommon checkString:_purchaseView.receiveWrh_name],
@"total":_purchaseView.total,
@"charge":_purchaseView.chargePurchase,
@"remark":_purchaseView.remark,
@"products":billProducts};
[IBTLoadingView showProgressLabel:msg];
[[ICRHTTPController sharedController] savePurchaseWithData:dict success:succ failure:fail];
}
#pragma mark - checkNull #pragma mark - checkNull
- (BOOL)checkPurchase{ - (BOOL)checkPurchase{
self.remark = _purchaseView.remarkTextView.text; _purchaseView.remark = _purchaseView.remarkTextView.text;
if (_purchaseView.vendor_uuid.length == 0 || _purchaseView.receiveWrh_uuid.length == 0 || _purchaseView.type.length == 0 || [self.total floatValue] < 0 || !self.total) { if (_purchaseView.type.length == 0 ) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示信息" message:@"信息不完整" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; ShowMessage(@"采购类型不能为空");
[alert show]; return NO;
}
if (_purchaseView.vendor_uuid.length == 0 ) {
ShowMessage(@"供应商不能为空");
return NO;
}
if (_purchaseView.receiveWrh_uuid.length == 0 ) {
ShowMessage(@"收货仓库不能为空");
return NO;
}
if (_pvc.productArr.count == 0) {
ShowMessage(@"采购商品不能为空");
return NO;
}
if ([_purchaseView.total floatValue] < 0 || !_purchaseView.total) {
ShowMessage(@"金额不能为空");
return NO; return NO;
} }
return YES; return YES;
...@@ -140,17 +224,6 @@ typedef enum : NSUInteger { ...@@ -140,17 +224,6 @@ typedef enum : NSUInteger {
[self PushViewController:vc animated:YES]; [self PushViewController:vc animated:YES];
} }
#pragma mark - ProductViewDelegate
- (void)pushViewController:(id)cvc selfController:(id)avc{
_avc = avc;
[self PushViewController:cvc animated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if (_avc) {
[AppWindow addSubview:_avc.view];
}
}
#pragma mark - 协议方法 #pragma mark - 协议方法
- (void)hiddenKeyBoard{ - (void)hiddenKeyBoard{
......
...@@ -7,15 +7,12 @@ ...@@ -7,15 +7,12 @@
// //
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
@protocol ProductViewDelegate <NSObject>
- (void)pushViewController:(id)cvc selfController:(id)avc; @interface ProductBillViewController: ICRBaseViewController
@end
@interface ProductViewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *productArr; @property (nonatomic,strong)NSMutableArray *productArr;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame; @property (nonatomic,assign)CGRect viewFrame;
@property (nonatomic,assign)BOOL isHiddenEdit; @property (nonatomic,assign)BOOL isHiddenEdit;
@property (nonatomic,weak)id<ProductViewDelegate>delegate;
@end @end
...@@ -6,23 +6,22 @@ ...@@ -6,23 +6,22 @@
// Copyright (c) 2015年 Xummer. All rights reserved. // Copyright (c) 2015年 Xummer. All rights reserved.
// //
#import "ProductViewController.h" #import "ProductBillViewController.h"
#import "FooterCell.h" #import "FooterCell.h"
#import "HeaderCell.h" #import "HeaderCell.h"
#import "ProductCell.h" #import "ProductBillCell.h"
#import "AddProductViewController.h"
#import "PurchaseBillProduct.h" #import "PurchaseBillProduct.h"
#define TableHeight 44 #define TableHeight 44
#define ShowHeight 100
@interface ProductViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,AddProductViewDelegate> @interface ProductBillViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
{ {
CGRect _tableFrame; CGRect _tableFrame;
NSMutableArray *_selectRowArr;//记录当前选中的cell NSMutableArray *_selectRowArr;//记录当前选中的cell
AddProductViewController *_avc;
} }
@end @end
@implementation ProductViewController @implementation ProductBillViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
...@@ -36,12 +35,25 @@ ...@@ -36,12 +35,25 @@
if (!self.productArr) { if (!self.productArr) {
self.productArr = [NSMutableArray array]; self.productArr = [NSMutableArray array];
} }
PurchaseBillProduct *billProduct = [PurchaseBillProduct new]; // PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
billProduct.total = [NSNumber numberWithFloat:25]; //
// billProduct.product_name = @"dd";
// billProduct.product_uuid = @"402880e64e287fe2014e28895b8a0032";
[self.productArr addObject:billProduct]; // billProduct.product_code = @"农夫山泉";
[self.productArr addObject:billProduct]; // billProduct.qpc = [NSNumber numberWithFloat:22];
// billProduct.unit = @"筐";
// billProduct.qty = [NSNumber numberWithFloat:23];
// billProduct.price = [NSNumber numberWithFloat:333];
// billProduct.baseQty = [NSNumber numberWithFloat:333];
// billProduct.basePrice = [NSNumber numberWithFloat:33];
// billProduct.total = [NSNumber numberWithFloat:25];
// billProduct.remark = @"hshshshsh";
// billProduct.qpcStr = @"fdsfdsfdsa";
// [self.productArr addObject:billProduct];
// [self.productArr addObject:billProduct];
if (self.productArr.count > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil];
}
} }
- (void)setViewFrame:(CGRect)viewFrame{ - (void)setViewFrame:(CGRect)viewFrame{
...@@ -69,33 +81,9 @@ ...@@ -69,33 +81,9 @@
} }
#pragma mark - footerDelegate #pragma mark - footerDelegate
- (void)addClick{ - (void)addClick{
// [self.productArr addObject:@"dddd"];
// [self.tableView reloadData];
if (_avc == nil) {
_avc = [[AddProductViewController alloc]init];
_avc.delegate = self;
_avc.view.backgroundColor = RGBA(0, 0, 0, 0.5);
[AppWindow addSubview:_avc.view];
}
}
#pragma mark - addProductViewDelegate
- (void)dissmiss{
if (_avc) {
[_avc.view removeFromSuperview];
_avc = nil;
}
} }
- (void)pushViewController:(id)cvc{
if (_avc) {
[_avc.view removeFromSuperview];
}
if ([self.delegate respondsToSelector:@selector(pushViewController:selfController:)]) {
[self.delegate pushViewController:cvc selfController:_avc];
}
}
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
...@@ -105,10 +93,10 @@ ...@@ -105,10 +93,10 @@
return self.productArr.count; return self.productArr.count;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"ProductCell"; static NSString *cellID = @"ProductBillCell";
ProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; ProductBillCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) { if (cell == nil) {
cell = [[ProductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; cell = [[ProductBillCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (self.isHiddenEdit) { if (self.isHiddenEdit) {
cell.editBtn.hidden = YES; cell.editBtn.hidden = YES;
...@@ -117,10 +105,10 @@ ...@@ -117,10 +105,10 @@
if ([self isHaveIndexPath:indexPath]) { if ([self isHaveIndexPath:indexPath]) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"]; cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
CGRect Linefrmame = cell.lineLabel.frame; CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = 200-1; Linefrmame.origin.y = ShowHeight + TableHeight -1;
cell.lineLabel.frame = Linefrmame; cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame; CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = 150; showfrmame.size.height = ShowHeight;
cell.showView.frame = showfrmame; cell.showView.frame = showfrmame;
cell.backgroundColor = XXFBgColor; cell.backgroundColor = XXFBgColor;
}else{ }else{
...@@ -135,6 +123,13 @@ ...@@ -135,6 +123,13 @@
} }
cell.editBtn.tag = indexPath.row; cell.editBtn.tag = indexPath.row;
[cell.editBtn addTarget:self action:@selector(editClick:) forControlEvents:UIControlEventTouchUpInside]; [cell.editBtn addTarget:self action:@selector(editClick:) forControlEvents:UIControlEventTouchUpInside];
if (self.productArr.count > 0) {
PurchaseBillProduct *billP = self.productArr[indexPath.row];
[cell setBillProduct:billP row:indexPath.row];
}
return cell; return cell;
} }
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{ - (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
...@@ -147,14 +142,14 @@ ...@@ -147,14 +142,14 @@
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
ProductCell *cell = (ProductCell *)[tableView cellForRowAtIndexPath:indexPath]; ProductBillCell *cell = (ProductBillCell *)[tableView cellForRowAtIndexPath:indexPath];
CGRect Linefrmame = cell.lineLabel.frame; CGRect Linefrmame = cell.lineLabel.frame;
CGRect showfrmame = cell.showView.frame; CGRect showfrmame = cell.showView.frame;
if (Linefrmame.origin.y == TableHeight - 1) { if (Linefrmame.origin.y == TableHeight - 1) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"]; cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
Linefrmame.origin.y = 200-1; Linefrmame.origin.y = ShowHeight + TableHeight - 1;
showfrmame.size.height = 150; showfrmame.size.height = ShowHeight;
cell.backgroundColor = [UIColor whiteColor]; cell.backgroundColor = [UIColor whiteColor];
[_selectRowArr addObject:indexPath]; [_selectRowArr addObject:indexPath];
}else{ }else{
...@@ -170,7 +165,7 @@ ...@@ -170,7 +165,7 @@
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if ([self isHaveIndexPath:indexPath]) { if ([self isHaveIndexPath:indexPath]) {
return 200; return ShowHeight + TableHeight;
} }
return TableHeight; return TableHeight;
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
// //
#import "PurchaseDetailViewController.h" #import "PurchaseDetailViewController.h"
#import "ProductViewController.h" #import "ProductBillViewController.h"
#import "PurchaseBillProduct.h"
#define BottomHeight 50 #define BottomHeight 50
#define LeftMargin 15 #define LeftMargin 15
#define LeftWidth 100 #define LeftWidth 100
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
typedef enum : NSUInteger { typedef enum : NSUInteger {
CancleTag = 3500, CancleTag = 3500,
EndTag,
RejectTag, RejectTag,
PassTag, PassTag,
SureTag SureTag
...@@ -28,7 +29,7 @@ typedef enum : NSUInteger { ...@@ -28,7 +29,7 @@ typedef enum : NSUInteger {
UIScrollView *_scrollView; UIScrollView *_scrollView;
UIView *_purchaseView; UIView *_purchaseView;
UIView *_bottomView; UIView *_bottomView;
ProductViewController *_pvc; ProductBillViewController *_pvc;
NSArray *_leftArr; NSArray *_leftArr;
UIButton *_endBtn; UIButton *_endBtn;
UIButton *_rejectBtn; UIButton *_rejectBtn;
...@@ -57,10 +58,37 @@ typedef enum : NSUInteger { ...@@ -57,10 +58,37 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view.
[self bulidLayout]; [self bulidLayout];
[self getDataFromServer];
}
- (void)getDataFromServer{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
NSDictionary *dictData = data[@"data"];
PurchaseBill *bill = [[PurchaseBill alloc]init];
[bill setValuesForKeysWithDictionary:dictData];
self.bill = bill;
[strongSelf fetchtPurchaseDetail];
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@" 无记录 "];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getPurchaseResultWithPurchaseUuid:@"5a7417014f926eb5014f93b18fbc000f" success:succ failure:fail];
} }
#pragma mark - 视图初始化 #pragma mark - 视图初始化
...@@ -80,31 +108,69 @@ typedef enum : NSUInteger { ...@@ -80,31 +108,69 @@ typedef enum : NSUInteger {
scrollViewFrame.size.height = ScreenSize.height - 64; scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame; _scrollView.frame = scrollViewFrame;
} }
[self fetchtPurchaseDetail];
} }
- (void)createBtn{ - (void)createBtn{
_rejectBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:RejectTag image:nil title:@"" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[self.view addSubview:_rejectBtn];
_endBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(_rejectBtn.frame)+ LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
_endBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin*2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"作废" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:_endBtn]; [self.view addSubview:_endBtn];
if (self.indexPerson == 0) { if (self.indexPerson == 0) {
_endBtn.tag = CancleTag; _rejectBtn.hidden = NO;
[_endBtn setTitle:@"作废" forState:UIControlStateNormal];
_rejectBtn.tag = CancleTag;
[_rejectBtn setTitle:@"作废" forState:UIControlStateNormal];
_endBtn.tag = EndTag;
[_endBtn setTitle:@"结束" forState:UIControlStateNormal];
}else if(self.indexPerson == 1){ }else if(self.indexPerson == 1){
_rejectBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:RejectTag image:nil title:@"拒绝" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR]; _rejectBtn.hidden = NO;
[self.view addSubview:_rejectBtn];
_rejectBtn.tag = RejectTag;
[_rejectBtn setTitle:@"拒绝" forState:UIControlStateNormal];
_endBtn.frame = CGRectMake(CGRectGetMaxX(_rejectBtn.frame)+ LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40);
[_endBtn setTitle:@"审核通过" forState:UIControlStateNormal]; [_endBtn setTitle:@"审核通过" forState:UIControlStateNormal];
_endBtn.tag = PassTag; _endBtn.tag = PassTag;
}else{ }else{
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = SureTag; _endBtn.tag = SureTag;
[_endBtn setTitle:@"确认" forState:UIControlStateNormal]; [_endBtn setTitle:@"确认" forState:UIControlStateNormal];
} }
}
- (void)btnClick:(UIButton *)btn{
NSLog(@"%ld",(long)btn.tag);
switch (btn.tag) {
case CancleTag:
{
NSLog(@"作废");
}
break;
case EndTag:
{
NSLog(@"结束");
}
break;
case RejectTag:
{
NSLog(@"拒绝");
}
break;
case PassTag:
{
NSLog(@"审核通过");
}
break;
case SureTag:
{
NSLog(@"确定");
}
break;
default:
break;
}
} }
- (void)createBottomView{ - (void)createBottomView{
...@@ -112,7 +178,7 @@ typedef enum : NSUInteger { ...@@ -112,7 +178,7 @@ typedef enum : NSUInteger {
_bottomView.backgroundColor = [UIColor whiteColor]; _bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView]; [_scrollView addSubview:_bottomView];
_pvc = [[ProductViewController alloc]init]; _pvc = [[ProductBillViewController alloc]init];
[self addChildViewController:_pvc]; [self addChildViewController:_pvc];
_pvc.viewFrame = _bottomView.bounds; _pvc.viewFrame = _bottomView.bounds;
...@@ -212,18 +278,26 @@ typedef enum : NSUInteger { ...@@ -212,18 +278,26 @@ typedef enum : NSUInteger {
self.stateLabel.textColor = [UIColor blackColor]; self.stateLabel.textColor = [UIColor blackColor];
self.stateLabel.text = @"已完成"; self.stateLabel.text = @"已完成";
} }
self.noticeNumberLabel.text = [IBTCommon checkString:self.bill.noticeNumber]; self.noticeNumberLabel.text = (self.bill.noticeNumber.length == 0) ? @"无":(self.bill.noticeNumber);
self.createOperNameLabel.text = [IBTCommon checkString:self.bill.create_operName]; self.createOperNameLabel.text = [IBTCommon checkString:self.bill.create_operName];
self.checkNameLabel.text = [IBTCommon checkString:self.bill.vendor_name]; self.checkNameLabel.text = [IBTCommon checkString:self.bill.vendor_name];
self.vendorNameLabel.text = [IBTCommon checkString:self.bill.vendor_name]; self.vendorNameLabel.text = [IBTCommon checkString:self.bill.vendor_name];
self.totalPriceLabel.text = [IBTCommon checkString:[self.bill.total stringValue]]; self.totalPriceLabel.text = [IBTCommon checkString:[self.bill.total stringValue]];
self.noteLabel.text = [IBTCommon checkString:self.bill.remark]; self.noteLabel.text = [IBTCommon checkString:self.bill.remark];
self.lastModifyNameLabel.text = @"最后修改人"; self.lastModifyNameLabel.text = [IBTCommon checkString:self.bill.lastModify_operName];
self.typeLabel.text = @"类型"; NSString *type = [self.bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
self.vendorIsSureLabel.text = @"是否确认"; self.typeLabel.text = type;
self.warehouseLabel.text = @"仓库"; self.vendorIsSureLabel.text = self.bill.vendorConfirmTime.length > 0 ? @"是":@"否";
self.otherPriceLabel.text = @"其他费用"; self.warehouseLabel.text = [IBTCommon checkString:self.bill.receiveWrh_name];
self.otherPriceLabel.text = [self.bill.charge stringValue];
NSMutableArray *productArr = [NSMutableArray array];
for (NSDictionary *billDict in self.bill.products) {
PurchaseBillProduct *billProbuct = [PurchaseBillProduct new];
[billProbuct setValuesForKeysWithDictionary:billDict];
[productArr addObject:billProbuct];
}
_pvc.productArr = productArr;
[_pvc.tableView reloadData];
[self setNoteHeight]; [self setNoteHeight];
} }
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
#import "PurchaseCell.h" #import "PurchaseCell.h"
#import "PurchaseBill.h" #import "PurchaseBill.h"
#import "PurchaseDetailViewController.h" #import "PurchaseDetailViewController.h"
#import "QueryOrder.h"
#import "SortMaskView.h" #import "SortMaskView.h"
#import "PurchaseBoltView.h" #import "PurchaseBoltView.h"
#import "MJRefresh.h"
#define TopMargin 44 #define TopMargin 44
#define TableHeight 120 #define TableHeight 120
...@@ -35,11 +36,14 @@ typedef enum : NSUInteger { ...@@ -35,11 +36,14 @@ typedef enum : NSUInteger {
UIBarButtonItem *_sureBtn; UIBarButtonItem *_sureBtn;
UIButton *_sortBtn; UIButton *_sortBtn;
UIButton *_boltBtn; UIButton *_boltBtn;
BOOL _isRefresh;
BOOL _isLoadMore;
NSInteger _currentPage;
} }
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSString *noticeLike; @property (nonatomic,strong)NSString *noticeLike;
@property (nonatomic,strong)NSString *state;//未提交=initial已提交=submitted调研中=insurvey已完成=finished @property (nonatomic,strong)NSString *state;
@property (nonatomic,strong)NSString *billLike; @property (nonatomic,strong)NSString *billLike;
@property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序) @property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序)
@end @end
...@@ -51,6 +55,9 @@ typedef enum : NSUInteger { ...@@ -51,6 +55,9 @@ typedef enum : NSUInteger {
self.view.backgroundColor = XXFBgColor; self.view.backgroundColor = XXFBgColor;
[self initData]; [self initData];
[self createTableView]; [self createTableView];
[self createRefresh];
[self getData];
} }
- (void)initData{ - (void)initData{
self.dataArr = [NSMutableArray array]; self.dataArr = [NSMutableArray array];
...@@ -63,7 +70,7 @@ typedef enum : NSUInteger { ...@@ -63,7 +70,7 @@ typedef enum : NSUInteger {
bill.vendor_name = @"供应商"; bill.vendor_name = @"供应商";
bill.total = [NSNumber numberWithFloat:22]; bill.total = [NSNumber numberWithFloat:22];
bill.remark = @"备注"; bill.remark = @"备注";
bill.lastModified_operName = @"最后修改人"; bill.lastModify_operName = @"最后修改人";
bill.vendorConfirmTime = @"否"; bill.vendorConfirmTime = @"否";
if (i == 0) { if (i == 0) {
bill.state = @"initial"; bill.state = @"initial";
...@@ -80,12 +87,145 @@ typedef enum : NSUInteger { ...@@ -80,12 +87,145 @@ typedef enum : NSUInteger {
} }
[self.dataArr addObject:bill]; [self.dataArr addObject:bill];
} }
}
- (void)getData{
[ICRUserUtil sharedInstance].needFresh = NO;
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchtPuchaseList:data];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSMutableArray *orderArr =[NSMutableArray array];
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"lastModified";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
id billObject = [NSNull null];
if (self.billLike.length > 0) {
billObject = self.billLike;
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"billNumber";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
}
id stateObject = [NSNull null];
if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
stateObject = self.state;
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"state";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
}
id noticeObject = [NSNull null];
if (self.noticeLike.length > 0) {
noticeObject = self.noticeLike;
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"noticeNumber";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
}
if (orderArr.count == 0) {
QueryOrder *order = [QueryOrder new];
order.field = @"billNumber";
order.direction = @"desc";
[orderArr addObject:[order dictForCommit]];
}
NSDictionary *dict = @{
@"billNumberLike":billObject,
@"state":stateObject,
@"noticeNumberLike":noticeObject,
@"titleLike":[NSNull null],
@"vendorUuid":[NSNull null],
@"queryOrders":orderArr,
@"userUuid":userUtil.userId,
@"pageNumber":@(_currentPage),
@"pageSize":@(20)};
[[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail];
}
- (void)fetchtPuchaseList:(id)data{
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
if (_currentPage == 0) {
// if (self.dataArr.count > 0) {
// [self.dataArr removeAllObjects];
// }
}
NSArray *recodesArr = data[ @"data" ][ @"records" ];
for (NSDictionary *purchaseBillDict in recodesArr) {
PurchaseBill *purchaseBill = [[PurchaseBill alloc]init];
[purchaseBill setValuesForKeysWithDictionary:purchaseBillDict];
[self.dataArr addObject:purchaseBill];
}
NSDictionary *pageDict = data[ @"data" ][ @"paging" ];
NSInteger pageCount = [pageDict[@"pageCount"] integerValue];
[self.tableView reloadData];
[self endRefreshing];
if (pageCount <= _currentPage) {
[self.tableView.footer noticeNoMoreData];
}
if (_currentPage == 0 && self.dataArr.count > 0) {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@" 无记录 "];
}
}
- (void)createRefresh{
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
if (_isRefresh) {
return ;
}
_isRefresh = YES;
_currentPage = 0;
[self getData];
}];
self.tableView.header.lastUpdatedTimeKey = PurchaseUpdateDate;
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (_isLoadMore) {
return ;
}
_isLoadMore = YES;
_currentPage ++;
[self getData];
} ];
}
#pragma mark - 结束刷新
- (void)endRefreshing{
_isLoadMore = NO;
_isRefresh = NO;
[self.tableView.header endRefreshing];
[self.tableView.footer endRefreshing];
} }
- (void)createTableView - (void)createTableView
{ {
_sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)]; _sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = _sureBtn;
_sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil]; _sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil];
_sortBtn.titleLabel.font = FontSize(BtnSize); _sortBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_sortBtn]; [self.view addSubview:_sortBtn];
...@@ -118,7 +258,6 @@ typedef enum : NSUInteger { ...@@ -118,7 +258,6 @@ typedef enum : NSUInteger {
[btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
[self hiddenSortMaskView:YES]; [self hiddenSortMaskView:YES];
currentBtn = nil; currentBtn = nil;
self.navigationItem.rightBarButtonItem = nil;
}else{ }else{
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) { if (_sortView == nil) {
...@@ -132,7 +271,6 @@ typedef enum : NSUInteger { ...@@ -132,7 +271,6 @@ typedef enum : NSUInteger {
_sortView.frame = sortFrame; _sortView.frame = sortFrame;
}]; }];
} }
self.navigationItem.rightBarButtonItem = _sureBtn;
currentBtn = btn; currentBtn = btn;
} }
}else if(btn.tag == BoltTag){ }else if(btn.tag == BoltTag){
...@@ -143,7 +281,6 @@ typedef enum : NSUInteger { ...@@ -143,7 +281,6 @@ typedef enum : NSUInteger {
[btn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
[self hiddenBoltMaskView:YES]; [self hiddenBoltMaskView:YES];
currentBtn = nil; currentBtn = nil;
self.navigationItem.rightBarButtonItem = nil;
}else{ }else{
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
...@@ -161,7 +298,6 @@ typedef enum : NSUInteger { ...@@ -161,7 +298,6 @@ typedef enum : NSUInteger {
_boltView.frame = sortFrame; _boltView.frame = sortFrame;
}]; }];
currentBtn = btn; currentBtn = btn;
self.navigationItem.rightBarButtonItem = _sureBtn;
} }
} }
} }
...@@ -225,6 +361,23 @@ typedef enum : NSUInteger { ...@@ -225,6 +361,23 @@ typedef enum : NSUInteger {
} }
#pragma mark - 确定 #pragma mark - 确定
- (void)sureClick{ - (void)sureClick{
if (self.state.length > 0 || self.billLike.length > 0 || self.noticeLike.length > 0 ||self.orderDirection.length > 0) {
[_boltView.noticeFiled resignFirstResponder];
[_boltView.billFiled resignFirstResponder];
_currentPage = 0;
//请求
[self getData];
//还原数据
if (_sortView) {
[self hiddenSortMaskView:YES];
}
if (_boltView) {
[self hiddenBoltMaskView:YES];
}
}
} }
#pragma mark - sortDelegate #pragma mark - sortDelegate
......
...@@ -17,17 +17,23 @@ ...@@ -17,17 +17,23 @@
@property (nonatomic,strong)NSString *vendor_uuid;//供应商uuid @property (nonatomic,strong)NSString *vendor_uuid;//供应商uuid
@property (nonatomic,strong)NSString *vendor_code;//供应商代码 @property (nonatomic,strong)NSString *vendor_code;//供应商代码
@property (nonatomic,strong)NSString *vendor_name;//供应商姓名 @property (nonatomic,strong)NSString *vendor_name;//供应商姓名
@property (nonatomic,strong)NSString *receiveWrh_uuid;//收货uuid
@property (nonatomic,strong)NSString *receiveWrh_code;//收货代码
@property (nonatomic,strong)NSString *receiveWrh_name;//收货姓名
@property (nonatomic,strong)NSString *rejectCause;//拒绝原因
@property (nonatomic,strong)NSNumber *total;//总金额 @property (nonatomic,strong)NSNumber *total;//总金额
@property (nonatomic,strong)NSNumber *charge;//费用 @property (nonatomic,strong)NSNumber *charge;//费用
@property (nonatomic,strong)NSString *endDate;//调研结束时间
@property (nonatomic,strong)NSString *remark;//备注 @property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,strong)NSString *state;// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成) @property (nonatomic,strong)NSString *state;// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
@property (nonatomic,strong)NSString *vendorConfirmTime;//供应商确认时间 @property (nonatomic,strong)NSString *vendorConfirmTime;//供应商确认时间
@property (nonatomic,strong)NSString *create_time;//创建时间 @property (nonatomic,strong)NSString *create_time;//创建时间
@property (nonatomic,strong)NSString *create_id;//创建人代码 @property (nonatomic,strong)NSString *create_id;//创建人代码
@property (nonatomic,strong)NSString *create_operName;//创建人名称 @property (nonatomic,strong)NSString *create_operName;//创建人名称
@property (nonatomic,strong)NSString *lastModified_time;//最后修改时间 @property (nonatomic,strong)NSString *lastModify_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码 @property (nonatomic,strong)NSString *lastModify_id;//最后修改人代码
@property (nonatomic,strong)NSString *lastModified_operName;//最后修改人名称 @property (nonatomic,strong)NSString *lastModify_operName;//最后修改人名称
@property (nonatomic,strong)NSString *type;//类型
@property (nonatomic,strong)NSArray *products;
@end @end
...@@ -7,26 +7,25 @@ ...@@ -7,26 +7,25 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "PurchaseBillProduct.h"
@interface ProductCell : UITableViewCell @interface ProductBillCell : UITableViewCell
@property (nonatomic,strong)UIImageView *smallImageView; @property (nonatomic,strong)UIImageView *smallImageView;
@property (nonatomic,strong)UIButton *editBtn; @property (nonatomic,strong)UIButton *editBtn;
@property (nonatomic,strong)UILabel *seqLabel; @property (nonatomic,strong)UILabel *seqLabel;
@property (nonatomic,strong)UILabel *titleLabel; @property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *priceLabel; @property (nonatomic,strong)UILabel *priceLabel;
//@property (nonatomic,strong)UILabel *standardLabel;
@property (nonatomic,strong)UILabel *countLabel; @property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UILabel *lineLabel; @property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIView *showView; @property (nonatomic,strong)UIView *showView;
@property (nonatomic,strong)UILabel *showStandLabel;
@property (nonatomic,strong)UILabel *showTitleLabel; @property (nonatomic,strong)UILabel *showCountLabel;
@property (nonatomic,strong)UILabel *showBaseCountLabel; @property (nonatomic,strong)UILabel *showBaseCountLabel;
@property (nonatomic,strong)UILabel *showDateLabel; @property (nonatomic,strong)UILabel *showPriceLabel;
@property (nonatomic,strong)UILabel *basePriceLabel; @property (nonatomic,strong)UILabel *showBasePriceLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel; @property (nonatomic,strong)UILabel *showTotalLabel;
@property (nonatomic,strong)UILabel *placeLabel; @property (nonatomic,strong)UILabel *showNoteLabel;
@property (nonatomic,strong)UILabel *qualityLabel;
@property (nonatomic,strong)UILabel *remarkLabel; - (void)setBillProduct:(PurchaseBillProduct *)billProduct row:(NSInteger)row;
@end @end
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
@property (nonatomic,strong)NSString *receiveWrh_uuid; @property (nonatomic,strong)NSString *receiveWrh_uuid;
@property (nonatomic,strong)NSString *receiveWrh_code; @property (nonatomic,strong)NSString *receiveWrh_code;
@property (nonatomic,strong)NSString *receiveWrh_name; @property (nonatomic,strong)NSString *receiveWrh_name;
@property (nonatomic,strong)NSNumber *total;
@property (nonatomic,strong)NSNumber *chargePurchase;
@property (nonatomic,strong)NSString *remark;
......
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
#import "ChooseWarehouseViewController.h" #import "ChooseWarehouseViewController.h"
#import "Vendor.h" #import "Vendor.h"
#define LeftMargin 15 #define LeftMargin 15
#define TopMargin 20
#define LeftWidth 80 #define LeftWidth 80
#define TableHeight 44
#define SpaceHeight 10 #define SpaceHeight 10
#define TitleSize 15 #define TopMargin 10
#define TableHeight 44
@interface TopPurchaseView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate> @interface TopPurchaseView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{ {
UITableView *_tableView; UITableView *_tableView;
...@@ -87,10 +85,11 @@ ...@@ -87,10 +85,11 @@
[cell.contentView addSubview:textField]; [cell.contentView addSubview:textField];
self.otherPriceFiled = textField; self.otherPriceFiled = textField;
self.otherPriceFiled.placeholder = @"请输入其他费用"; self.otherPriceFiled.placeholder = @"请输入其他费用";
[self.otherPriceFiled addTarget:self action:@selector(boxValueChanged:) forControlEvents:UIControlEventEditingChanged];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame) + 5, 0, 20, TableHeight)]; UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame) + 5, 0, 20, TableHeight)];
label.text = @"元"; label.text = @"元";
label.textColor = GXF_CONTENT_COLOR; label.textColor = GXF_CONTENT_COLOR;
label.font = FontSize(TitleSize); label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label]; [cell.contentView addSubview:label];
}else if (indexPath.row == _dataArr.count -1){ }else if (indexPath.row == _dataArr.count -1){
...@@ -108,7 +107,7 @@ ...@@ -108,7 +107,7 @@
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))]; UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight; contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = GXF_PLACEHOLDER_COLOR; contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = FontSize(TitleSize); contentLabel.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:contentLabel]; [cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) { if (indexPath.row == 0) {
contentLabel.text = @"采购通知单号"; contentLabel.text = @"采购通知单号";
...@@ -133,16 +132,23 @@ ...@@ -133,16 +132,23 @@
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(contentLabel.frame)+ 5, 0, 20, TableHeight)]; UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(contentLabel.frame)+ 5, 0, 20, TableHeight)];
label.text = @"元"; label.text = @"元";
label.textColor = GXF_CONTENT_COLOR; label.textColor = GXF_CONTENT_COLOR;
label.font = FontSize(TitleSize); label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label]; [cell.contentView addSubview:label];
} }
} }
[self prepareDataInCell];
}
- (void)prepareDataInCell{
if (self.total) {
self.purchasePriceLabel.text = [self.total stringValue];
}
} }
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 2){ if(indexPath.row == 2){
ChooseVendorViewController *cvc = [ChooseVendorViewController new]; ChooseVendorViewController *cvc = [ChooseVendorViewController new];
cvc.title = @"供应商";
cvc.choseVendor = ^(NSArray *vendors){ cvc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) { if (vendors.count > 0) {
Vendor *vendor = vendors[0]; Vendor *vendor = vendors[0];
...@@ -158,17 +164,18 @@ ...@@ -158,17 +164,18 @@
[self.delegate pushNextViewController:cvc]; [self.delegate pushNextViewController:cvc];
}else if(indexPath.row == 1){ }else if(indexPath.row == 1){
ChooseTypeViewController *tvc = [[ChooseTypeViewController alloc]init]; ChooseTypeViewController *tvc = [[ChooseTypeViewController alloc]init];
tvc.title = @"类型";
tvc.dataArr = @[@"普通",@"紧急"];
tvc.choseType = ^(NSString *type){ tvc.choseType = ^(NSString *type){
self.purchaseTypeLabel.text = type; self.purchaseTypeLabel.text = type;
self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR; self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR;
self.type = type; if ([type isEqualToString:@"紧急"]) {
self.type = GXF_Critical;
}else{
self.type = GXF_Normal;
}
}; };
[self.delegate pushNextViewController:tvc]; [self.delegate pushNextViewController:tvc];
}else if(indexPath.row == 3){ }else if(indexPath.row == 3){
ChooseWarehouseViewController *wvc = [[ChooseWarehouseViewController alloc]init]; ChooseWarehouseViewController *wvc = [[ChooseWarehouseViewController alloc]init];
wvc.title = @"仓库";
wvc.choseWarehouse = ^(Warehouse *warehouse){ wvc.choseWarehouse = ^(Warehouse *warehouse){
self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code]; self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
self.purchaseStoreLabel.textColor = GXF_CONTENT_COLOR; self.purchaseStoreLabel.textColor = GXF_CONTENT_COLOR;
...@@ -190,14 +197,12 @@ ...@@ -190,14 +197,12 @@
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self.delegate hiddenKeyBoard]; [self.delegate hiddenKeyBoard];
} }
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.otherPriceFiled) { - (void)boxValueChanged:(UITextField *)textFiled{
if (self.otherPriceFiled.text.length > 0) { if (self.otherPriceFiled.text.length > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil];
}
} }
} }
@end @end
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
// //
#import "ChooseProductViewController.h" #import "ChooseProductViewController.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseProductViewController () @interface ChooseProductViewController ()
{ {
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
self.title = @"选择商品"; self.title = @"选择商品";
[self fetchProductList:@""]; [self fetchProductList:@""];
} }
- (void)getBaseDataFromLocal{ - (void)getBaseDataFromServer{
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
...@@ -55,7 +56,7 @@ ...@@ -55,7 +56,7 @@
if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseProductUpdateDate]) { if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseProductUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseProductUpdateDate]; [GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseProductUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize]; [GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromLocal]; [self getBaseDataFromServer];
}else{ }else{
[strongSelf.dataArr removeAllObjects]; [strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime]; [strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
#import "ChosePersonViewController.h" #import "ChosePersonViewController.h"
#import "SurveyUser.h" #import "SurveyUser.h"
#import "User.h" #import "User.h"
#define TopMargin 50
#define TableHeight 50
@interface ChosePersonViewController (){ @interface ChosePersonViewController (){
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
} }
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
[self fetchUserList:@""]; [self fetchUserList:@""];
} }
- (void)getBaseDataFromLocal{ - (void)getBaseDataFromServer{
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
if (![GXF_NSUSERFEFTAULTS objectForKey:ChoosePersonUpdateDate]) { if (![GXF_NSUSERFEFTAULTS objectForKey:ChoosePersonUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChoosePersonUpdateDate]; [GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChoosePersonUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize]; [GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromLocal]; [self getBaseDataFromServer];
}else{ }else{
[strongSelf.dataArr removeAllObjects]; [strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime]; [strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
......
...@@ -211,7 +211,7 @@ typedef enum : NSUInteger { ...@@ -211,7 +211,7 @@ typedef enum : NSUInteger {
uuidObject = uuidS; uuidObject = uuidS;
billNumberObject = billNumberS; billNumberObject = billNumberS;
versionObject = versionN; versionObject = versionN;
[IBTLoadingView showTips:[NSString stringWithFormat:@"当前单据%@保存成功",billNumberS]]; [IBTLoadingView showTips:[NSString stringWithFormat:@"当前单据%@保存成功",billNumberS]];
}else{//提交成功 }else{//提交成功
SurveyViewController *svc = [SurveyViewController new]; SurveyViewController *svc = [SurveyViewController new];
[self PushViewController:svc animated:YES]; [self PushViewController:svc animated:YES];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment