Commit 97704d9f authored by 陈俊俊's avatar 陈俊俊

采购通知筛选

parent 21e2a3fd
......@@ -149,6 +149,7 @@
72F9D4821BA7EC9600795A00 /* NoticeProductViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D4811BA7EC9600795A00 /* NoticeProductViewController.m */; };
72F9D4851BA7FFC400795A00 /* PurchaseNotice.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D4841BA7FFC400795A00 /* PurchaseNotice.m */; };
72F9D4881BA8065500795A00 /* PurchaseNoticeListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D4871BA8065500795A00 /* PurchaseNoticeListCell.m */; };
72F9D48B1BA8582100795A00 /* NoticeBoltView.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D48A1BA8582100795A00 /* NoticeBoltView.m */; };
871F9F047CDDAC523E4358DC /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 86D33EC280C440156ED1B976 /* libPods.a */; };
C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; };
C10214CE1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; };
......@@ -697,6 +698,8 @@
72F9D4841BA7FFC400795A00 /* PurchaseNotice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseNotice.m; sourceTree = "<group>"; };
72F9D4861BA8065500795A00 /* PurchaseNoticeListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseNoticeListCell.h; sourceTree = "<group>"; };
72F9D4871BA8065500795A00 /* PurchaseNoticeListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseNoticeListCell.m; sourceTree = "<group>"; };
72F9D4891BA8582100795A00 /* NoticeBoltView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoticeBoltView.h; sourceTree = "<group>"; };
72F9D48A1BA8582100795A00 /* NoticeBoltView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoticeBoltView.m; sourceTree = "<group>"; };
7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
86D33EC280C440156ED1B976 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
C10214CB1AD8FE200024637E /* ICRStoreDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRStoreDetailViewController.h; sourceTree = "<group>"; };
......@@ -1097,6 +1100,8 @@
72F9D4811BA7EC9600795A00 /* NoticeProductViewController.m */,
72F9D4861BA8065500795A00 /* PurchaseNoticeListCell.h */,
72F9D4871BA8065500795A00 /* PurchaseNoticeListCell.m */,
72F9D4891BA8582100795A00 /* NoticeBoltView.h */,
72F9D48A1BA8582100795A00 /* NoticeBoltView.m */,
);
path = Views;
sourceTree = "<group>";
......@@ -2632,6 +2637,7 @@
C1374F581B33C40D00594D19 /* IBTWebViewController.m in Sources */,
C159186B1AC1A03B0013B391 /* ICRSyncViewController.m in Sources */,
C1C564431AD66C6E006A1050 /* ICRTaskEditViewController.m in Sources */,
72F9D48B1BA8582100795A00 /* NoticeBoltView.m in Sources */,
C142D2AA1AC3A155000109A7 /* NSDate+FormatterAdditions.m in Sources */,
C1B307A31ADD199600657F11 /* ICRTaskResultContentView.m in Sources */,
72873CEB1BA27BA6007B3387 /* GXFPopView.m in Sources */,
......
......@@ -276,7 +276,8 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
failure:(void (^)(id))fail;
//3·采购通知单明细(读)
- (void)getPurchaseNoticeDetailedWithPurchaseUuid:(NSString *)purchaseUuid success:(void (^)(id))succ
- (void)getPurchaseNoticeDetailedWithPurchaseUuid:(NSString *)purchaseUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//4·保存并提交采购通知单
- (void)saveAndSubmitPurchaseNoticeWithData:(id)data
......@@ -288,12 +289,13 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//6·接受采购通知单
- (void)acceptPurchaseNoticeWithData:(id)data
- (void)acceptPurchaseNoticeWithUuid:(NSString *)purchaseNoticeuuid
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//7·结束采购通知单
- (void)finishPurchaseNoticeWithData:(id)data
success:(void (^)(id))succ
- (void)finishPurchaseNoticeWithUuid:(NSString *)purchaseNoticeuuid
version:(NSNumber *)version success:(void (^)(id))succ
failure:(void (^)(id))fail;
//8·获取采购通知单跟进记录
- (void)getPurchaseNoticeRecodWithData:(id)data
......
......@@ -187,8 +187,8 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_getPurchaseNoticeDetailed] = @"purchase/notice/get",
[XFFHttp_saveAndSubmitPurchaseNotice] = @"purchase/notice/saveandsubmit",
[XFFHttp_ComitPurchaseNotice] = @"purchase/notice/submit/",
[XFFHttp_acceptPurchaseNotice] = @"purchase/notice/accept/",
[XFFHttp_finishPurchaseNotice] = @"purchase/notice/finish/",
[XFFHttp_acceptPurchaseNotice] = @"purchase/notice/accept",
[XFFHttp_finishPurchaseNotice] = @"purchase/notice/finish",
[XFFHttp_getPurchaseNoticeRecod] = @"purchase/trace/get/",
......@@ -2392,17 +2392,76 @@ acceptTypeJson:YES
}
//6·接受采购通知单
- (void)acceptPurchaseNoticeWithData:(id)data
- (void)acceptPurchaseNoticeWithUuid:(NSString *)purchaseNoticeuuid
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail
{
if (!purchaseNoticeuuid) {
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_acceptPurchaseNotice] stringByAppendingFormat:@"/%@?version=%@&time=%@&operId=%@&operName=%@",purchaseNoticeuuid,version,[[NSDate date] httpParameterString],userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//7·结束采购通知单
- (void)finishPurchaseNoticeWithData:(id)data
- (void)finishPurchaseNoticeWithUuid:(NSString *)purchaseNoticeuuid
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail
{
if (!purchaseNoticeuuid) {
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_finishPurchaseNotice] stringByAppendingFormat:@"/%@?version=%@&time=%@&operId=%@&operName=%@",purchaseNoticeuuid,version,[[NSDate date] httpParameterString],userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//8·获取采购通知单跟进记录
......
......@@ -8,6 +8,8 @@
#import "ICRBaseViewController.h"
#import "PurchaseBill.h"
#import "PurchaseNotice.h"
@interface NewPurchaseViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *purchaseBill;
@property (nonatomic,strong)PurchaseNotice *purchaseNotice;
@end
......@@ -14,6 +14,7 @@
#import "ShopDetaileViewController.h"
#import "PurchaseBillProduct.h"
#import "GXFPopView.h"
#import "NoticeProduct.h"
#define TopHeight 328
#define BottomHeight 300
#define SpaceHeight 20
......@@ -61,6 +62,13 @@ typedef enum : NSUInteger {
if (self.purchaseBill) {
[self getDataFromServer];
}
if (self.purchaseNotice) {
_purchaseView.noticeUuid = self.purchaseNotice.uuid;
_purchaseView.noticeNumber = self.purchaseNotice.billnumber;
//转换
NSMutableArray *arr = [self coverPurchaseBillProduct:self.purchaseNotice.products];
_pvc.productArr = arr;
}
}
- (void)getDataFromServer{
__weak typeof(self)weakSelf = self;
......@@ -344,7 +352,27 @@ typedef enum : NSUInteger {
return shopDetail;
}
- (NSMutableArray *)coverPurchaseBillProduct:(NSArray *)arr{
NSMutableArray *billArr = [NSMutableArray array];
for (NoticeProduct *product in arr) {
PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
billProduct.uuid = product.uuid;
billProduct.product_name = product.productName;
billProduct.product_uuid = product.productUuid;
billProduct.product_code = product.productCode;
billProduct.qpc = product.qpc;
billProduct.unit = product.packUnit;
billProduct.qty = [NSNumber numberWithFloat:0];
billProduct.price = [NSNumber numberWithFloat:0];
billProduct.baseQty = [NSNumber numberWithFloat:0];
billProduct.basePrice = [NSNumber numberWithFloat:0];
billProduct.total = [NSNumber numberWithFloat:0];
billProduct.remark = product.remark;
billProduct.qpcStr = @"";
[billArr addObject:billProduct];
}
return billArr;
}
#pragma mark - 协议方法
- (void)hiddenKeyBoard{
......
......@@ -183,11 +183,14 @@
}
}
}
#warning 有点问题
- (void)prepareDataInCell{
if (self.total) {
self.purchasePriceLabel.text = [self.total stringValue];
}
if (self.noticeNumber.length > 0) {
self.purchaseNoticeLabel.text = self.noticeNumber;
self.purchaseNoticeLabel.textColor = GXF_CONTENT_COLOR;
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 2){
......
......@@ -11,7 +11,7 @@
#import "NewPurchaseNoticeViewController.h"
#import "QueryOrder.h"
#import "SortMaskView.h"
#import "PurchaseBoltView.h"
#import "NoticeBoltView.h"
#import "MJRefresh.h"
#import "PurchaseNoticeListCell.h"
#import "PurchaseNotice.h"
......@@ -27,12 +27,12 @@ typedef enum : NSUInteger {
BoltTag
} BtnTag;
@interface PurchaseNoticeViewController ()<UITableViewDataSource,UITableViewDelegate,PurchaseViewDelegate,SortMaskViewDelegate>
@interface PurchaseNoticeViewController ()<UITableViewDataSource,UITableViewDelegate,BoltMaskViewDelegate,SortMaskViewDelegate>
{
UIView *_maskView;
UIButton *currentBtn;
SortMaskView *_sortView;
PurchaseBoltView *_boltView;
NoticeBoltView *_boltView;
UIBarButtonItem *_sureBtn;
UIButton *_sortBtn;
UIButton *_boltBtn;
......@@ -42,7 +42,7 @@ typedef enum : NSUInteger {
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSString *noticeLike;
@property (nonatomic,strong)NSString *titleLike;
@property (nonatomic,strong)NSString *state;
@property (nonatomic,strong)NSString *billLike;
@property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序)
......@@ -76,7 +76,7 @@ typedef enum : NSUInteger {
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
// ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSMutableArray *orderArr =[NSMutableArray array];
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
......@@ -106,11 +106,11 @@ typedef enum : NSUInteger {
}
}
id noticeObject = [NSNull null];
if (self.noticeLike.length > 0) {
noticeObject = self.noticeLike;
if (self.titleLike.length > 0) {
noticeObject = self.titleLike;
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"noticeNumber";
order.field = @"titleLike";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
......@@ -260,13 +260,10 @@ typedef enum : NSUInteger {
}else{
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
if (_boltView == nil) {
_boltView = [[PurchaseBoltView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 274) state:self.state billNumber:self.billLike titleStr:@"采购通知" vendorNumber:self.noticeLike];
// _boltView = [[PurchaseBoltView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 274) state:self.state billNumber:self.billLike noticeNumber:self.noticeLike];
_boltView = [[NoticeBoltView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 274) state:self.state title:self.titleLike bill:self.billLike];
_boltView.backgroundColor = XXFBgColor;
_boltView.delegate = self;
//initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"未提交",@"已提交",@"已拒绝" ,@"已审批",@"发运中",@"已完成",nil];
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"不限",@"未提交",@"未接受",@"发运中",@"已完成",nil];
[_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _boltView.frame;
......@@ -328,7 +325,7 @@ typedef enum : NSUInteger {
}
}
- (void)checkBoltBtnColor{
if (self.state.length > 0 || self.noticeLike.length > 0 || self.billLike.length > 0) {
if (self.state.length > 0 || self.titleLike.length > 0 || self.billLike.length > 0) {
[_boltBtn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
}else{
[_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
......@@ -338,9 +335,7 @@ typedef enum : NSUInteger {
#pragma mark - 确定
- (void)sureClick{
if (self.state.length > 0 || self.billLike.length > 0 || self.noticeLike.length > 0 ||self.orderDirection.length > 0) {
[_boltView.titleFiled resignFirstResponder];
[_boltView.vendorFiled resignFirstResponder];
[_boltView.billFiled resignFirstResponder];
_currentPage = 0;
......@@ -353,8 +348,6 @@ typedef enum : NSUInteger {
if (_boltView) {
[self hiddenBoltMaskView:YES];
}
}
}
#pragma mark - sortDelegate
......@@ -369,21 +362,21 @@ typedef enum : NSUInteger {
self.state = state;
CLog(@"%@",state);
}
- (void)getbillLike:(NSString *)billLike{
self.billLike = billLike;
CLog(@"%@",billLike);
- (void)getBillNumber:(NSString *)billNumber{
self.billLike = billNumber;
CLog(@"%@",billNumber);
}
- (void)getnoticeLike:(NSString *)noticeLike{
self.noticeLike = noticeLike;
CLog(@"%@",noticeLike);
- (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike;
CLog(@"%@",titleLike);
}
- (void)clearBoltInformation{
//清空所有条件
if (self.billLike.length > 0) {
self.billLike = @"";
}
if (self.noticeLike.length > 0) {
self.noticeLike = @"";
if (self.titleLike.length > 0) {
self.titleLike = @"";
}
if (self.state.length > 0) {
self.state = @"";
......@@ -432,6 +425,12 @@ typedef enum : NSUInteger {
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if ([ICRUserUtil sharedInstance].needFresh && self.tableView != nil) {
[self.tableView.header beginRefreshing];
}
}
- (void)createBackBtn{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
......
......@@ -9,6 +9,8 @@
#import "SeePurchaseNoticeViewController.h"
#import "ProductBillViewController.h"
#import "PurchaseBillProduct.h"
#import "NewPurchaseViewController.h"
#import "NoticeProduct.h"
#define BottomHeight 50
#define LeftMargin 15
#define LeftWidth 100
......@@ -62,6 +64,13 @@ typedef enum : NSUInteger {
NSDictionary *dictData = data[@"data"];
PurchaseNotice *purchaseNotice = [[PurchaseNotice alloc]init];
[purchaseNotice setValuesForKeysWithDictionary:dictData];
NSMutableArray *productArr = [NSMutableArray new];
for (NSDictionary *productDict in dictData[@"products"]) {
NoticeProduct *noticeProduct = [NoticeProduct new];
[noticeProduct setValuesForKeysWithDictionary:productDict];
[productArr addObject:noticeProduct];
}
purchaseNotice.products = productArr;
strongSelf.purchaseNotice = purchaseNotice;
[strongSelf fetchtNoticeDetail];
}else{
......@@ -94,7 +103,7 @@ typedef enum : NSUInteger {
self.titleLabel.text = [IBTCommon checkString:self.purchaseNotice.title];
self.userLabel.text = [IBTCommon checkString:self.purchaseNotice.purchaserName];
self.countLabel.text = @"";
self.countLabel.text = [NSString stringWithFormat:@"%@",@"222"];
self.noteLabel.text = [IBTCommon checkString:self.purchaseNotice.remark];
// [_transView refreshTranProduct:self.transport.pdtDetails];
......@@ -137,16 +146,22 @@ typedef enum : NSUInteger {
_rejectBtn.tag = AcceptTag;
[_rejectBtn setTitle:@"接受任务" forState:UIControlStateNormal];
_endBtn.tag = NewTag;
_endBtn.backgroundColor = [UIColor grayColor];
_endBtn.backgroundColor = [UIColor lightGrayColor];
_endBtn.enabled = NO;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
}else{
if ([self checkIsPermission:NOTICE_PERMISSIONS_ACCEPTTASK]) {
_rejectBtn.tag = AcceptTag;
[_rejectBtn setTitle:@"接受任务" forState:UIControlStateNormal];
}
if ([self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]) {
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = AcceptTag;
[_endBtn setTitle:@"接受任务" forState:UIControlStateNormal];
}else if ([self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]) {
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = NewTag;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
}else{
[self hiddenBottomBtn];
}
}
}else if([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_PURCHASEING]){
......@@ -155,6 +170,11 @@ typedef enum : NSUInteger {
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = EndTag;
[_endBtn setTitle:@"结束" forState:UIControlStateNormal];
}else if([self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]){
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = NewTag;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
}else{
[self hiddenBottomBtn];
}
......@@ -176,23 +196,62 @@ typedef enum : NSUInteger {
case EndTag:
{
NSLog(@"结束");
[self dealByAction:@"end"];
}
break;
case NewTag:
{
NSLog(@"新建");
NewPurchaseViewController *nvc = [NewPurchaseViewController new];
nvc.title = @"新建采购单";
nvc.purchaseNotice = self.purchaseNotice;
[self PushViewController:nvc animated:YES];
}
break;
case AcceptTag:
{
NSLog(@"接受");
[self dealByAction:@"accept"];
}
break;
default:
break;
}
}
- (void)dealByAction:(NSString *)action{
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
if ([action isEqualToString:@"accept"]) {
_stateLabel.text = @"发运中";
_endBtn.enabled = YES;
_endBtn.backgroundColor = GXF_COMMIT_COLOR;
_rejectBtn.enabled = NO;
_rejectBtn.backgroundColor = [UIColor lightGrayColor];
}else{
[ICRUserUtil sharedInstance].needFresh = YES;
[self PopViewControllerAnimated:YES];
}
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@"操作异常"];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
if ([action isEqualToString:@"accept"]) {
[[ICRHTTPController sharedController] acceptPurchaseNoticeWithUuid:self.purchaseNotice.uuid version:self.purchaseNotice.version success:succ failure:fail];
}else{
[[ICRHTTPController sharedController] finishPurchaseNoticeWithUuid:self.purchaseNotice.uuid version:self.purchaseNotice.version success:succ failure:fail];
}
}
- (void)createBottomView{
_bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width, 200)];
......@@ -209,7 +268,7 @@ typedef enum : NSUInteger {
- (void)createPurchaseView{
_leftArr = @[@"单号:",@"创建人:",@"标题:",@"状态:",@"状态:",@"采购员:",@"合计基础数量:",@"备注:"];
_leftArr = @[@"单号:",@"创建人:",@"标题:",@"状态:",@"采购员:",@"合计基础数量:",@"备注:"];
_purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*_leftArr.count +LeftMargin)];
_purchaseView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_purchaseView];
......@@ -235,7 +294,13 @@ typedef enum : NSUInteger {
self.stateLabel = rightLabel;
}else if(i == 4){
self.userLabel = rightLabel;
}else if(i == 4){
}else if(i == 5){
CGRect leftFame = leftLabel.frame;
leftFame.size.width = 110;
leftLabel.frame = leftFame;
CGRect rightFrame = rightLabel.frame;
rightFrame.origin.x = CGRectGetMaxX(leftLabel.frame);
rightLabel.frame = rightFrame;
self.countLabel = rightLabel;
}else if(i == _leftArr.count - 1){
rightLabel.numberOfLines = 0;
......@@ -244,52 +309,6 @@ typedef enum : NSUInteger {
[_purchaseView addSubview:rightLabel];
}
}
- (void)fetchtPurchaseDetail{
// self.billNumberLabel.text = [IBTCommon checkString:self.bill.billNumber];
// if ([self.bill.state isEqualToString:PURCHASE_STATE_INITIAL]) {
// self.stateLabel.textColor = [UIColor redColor];
// self.stateLabel.text = @"未提交";
// }else if ([self.bill.state isEqualToString:PURCHASE_STATE_SUBMITTED]) {
// self.stateLabel.textColor = [UIColor greenColor];
// self.stateLabel.text = @"已提交";
// }else if ([self.bill.state isEqualToString:PURCHASE_STATE_REJECTED]) {
// self.stateLabel.textColor = [UIColor grayColor];
// self.stateLabel.text = @"已拒绝";
// }else if ([self.bill.state isEqualToString:PURCHASE_STATE_SHIPPING]) {
// self.stateLabel.textColor = [UIColor grayColor];
// self.stateLabel.text = @"已审批";
// }else if ([self.bill.state isEqualToString:PURCHASE_STATE_SHIPPING]) {
// self.stateLabel.textColor = [UIColor grayColor];
// self.stateLabel.text = @"发运中";
// }else if ([self.bill.state isEqualToString:PURCHASE_STATE_FINISHED]) {
// self.stateLabel.textColor = [UIColor blackColor];
// self.stateLabel.text = @"已完成";
// }
// self.noticeNumberLabel.text = (self.bill.noticeNumber.length == 0) ? @"无":(self.bill.noticeNumber);
// self.createOperNameLabel.text = [IBTCommon checkString:self.bill.create_operName];
// self.checkNameLabel.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.noteLabel.text = [IBTCommon checkString:self.bill.remark];
// self.lastModifyNameLabel.text = [IBTCommon checkString:self.bill.lastModify_operName];
// NSString *type = [self.bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
// self.typeLabel.text = type;
// self.vendorIsSureLabel.text = self.bill.vendorConfirmTime.length > 0 ? @"是":@"否";
// 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];
}
- (void)setNoteHeight
{
CGFloat height = [self.noteLabel calculateHeight];
......
//
// NoticeBoltView.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol BoltMaskViewDelegate <NSObject>
- (void)getBoltValueSelectRow:(NSString *)state;
- (void)getTitleLike:(NSString *)titleLike;
- (void)getBillNumber:(NSString *)billNumber;
- (void)clearBoltInformation;
@end
@interface NoticeBoltView : UIView<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <BoltMaskViewDelegate>delegate;
@property (nonatomic,strong)UITextField *titleFiled;
@property (nonatomic,strong)UITextField *billFiled;
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill;
@end
//
// NoticeBoltView.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "NoticeBoltView.h"
#import "MaskCell.h"
#define TableHeight 45
#define LeftMargin 80
#define TotalHeight 224
#define LeftHeight 44
#define BottomHeight 50
@interface NoticeBoltView ()<UITextFieldDelegate>
{
UIView *_leftView;
UIButton *_currentBtn;
NSIndexPath *_currentIndexPath;
UIView *_titleView;
UIView *_billNumberView;
NSString *_state;
NSString *_billNumber;
NSString *_title;
UIButton *_clearBtn;
}
@property (nonatomic,strong)NSString *state;
@property (nonatomic,strong)NSString *title;
@property (nonatomic,strong)NSString *billNumber;
@end
@implementation NoticeBoltView
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill{
self = [super initWithFrame:frame];
if (self) {
self.title = title;
self.billNumber = bill;
self.state = state;
[self createView];
[self createRightView];
[self preferData];
}
return self;
}
- (void)preferData{
//initial(未提交),submitted(已提交),insurvey(调研中)
if ([self.state isEqualToString:@"none"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([self.state isEqualToString:PURCHASENOTICE_STATE_INITIAL]) {
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else if ([self.state isEqualToString:PURCHASENOTICE_STATE_NOTACCEPTED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
}else if ([self.state isEqualToString:PURCHASENOTICE_STATE_PURCHASEING]) {
_currentIndexPath = [NSIndexPath indexPathForRow:3 inSection:0];
}else if ([self.state isEqualToString:PURCHASENOTICE_STATE_FINISHED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:4 inSection:0];
}
_titleView.hidden = YES;
if(self.title.length > 0){
self.titleFiled.text = self.title;
}
_billNumberView.hidden = YES;
if (self.billNumber.length > 0) {
self.billFiled.text = self.billNumber;
}
}
#pragma mark - 创建视图
- (void)createView
{
_leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height- BottomHeight)];
[self addSubview:_leftView];
NSArray *arr = @[@"按状态",@"单号",@"标题"];
for (NSInteger i = 0; i<arr.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
[button setTitle:arr[i] forState:UIControlStateNormal];
[button setTitleColor:GXF_DETAIL_COLOR forState:UIControlStateNormal];
if (i == 0) {
button.enabled = NO;
_currentBtn = button;
}
[button setBackgroundImage:[UIImage imageNamed:@"maskEnable"] forState:UIControlStateDisabled];
[button setBackgroundImage:[UIImage imageNamed:@"mask"] forState:UIControlStateNormal];
button.tag = 1001+i;
[button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_leftView addSubview:button];
}
_clearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_clearBtn.frame = CGRectMake(0, CGRectGetMaxY(_leftView.frame), self.frame.size.width, BottomHeight);
[_clearBtn setTitle:@"清空选项" forState:UIControlStateNormal];
[_clearBtn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
_clearBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[_clearBtn addTarget:self action:@selector(clearBolt) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_clearBtn];
}
- (void)createRightView{
_titleView = [[UIView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height - BottomHeight)];
_titleView.backgroundColor = [UIColor whiteColor];
[self addSubview:_titleView];
UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
titleLabel.font = GXF_FIFTEENTEN_SIZE;
titleLabel.text = @"类似于:";
[_titleView addSubview:titleLabel];
self.titleFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.titleFiled.textAlignment = NSTextAlignmentLeft;
self.titleFiled.textColor = GXF_CONTENT_COLOR;
self.titleFiled.placeholder = @"输入类似标题";
self.titleFiled.borderStyle = UITextBorderStyleRoundedRect;
self.titleFiled.font = GXF_FIFTEENTEN_SIZE;
self.titleFiled.returnKeyType = UIReturnKeyDone;
self.titleFiled.delegate = self;
[_titleView addSubview:self.titleFiled];
_billNumberView = [[UIView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height - BottomHeight)];
_billNumberView.backgroundColor = [UIColor whiteColor];
[self addSubview:_billNumberView];
UILabel *billLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
billLabel.font = GXF_FIFTEENTEN_SIZE;
billLabel.text = @"类似于:";
[_billNumberView addSubview:billLabel];
self.billFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(billLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.billFiled.textAlignment = NSTextAlignmentLeft;
self.billFiled.textColor = GXF_CONTENT_COLOR;
self.billFiled.placeholder = @"输入类似单号";
self.billFiled.borderStyle = UITextBorderStyleRoundedRect;
self.billFiled.font = GXF_FIFTEENTEN_SIZE;
self.billFiled.returnKeyType = UIReturnKeyDone;
self.billFiled.delegate = self;
[_billNumberView addSubview:self.billFiled];
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height - BottomHeight) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self addSubview:self.tableView];
}
- (void)leftBtnClick:(UIButton *)btn{
_currentBtn.enabled = YES;
btn.enabled = NO;
_currentBtn = btn;
[self keyBoardHidden];
switch (btn.tag) {
case 1001://状态
{
self.tableView.hidden = NO;
_titleView.hidden = YES;
_billNumberView.hidden = YES;
}
break;
case 1002://条件二
{
self.tableView.hidden = YES;
_titleView.hidden = YES;
_billNumberView.hidden = NO;
}
break;
case 1003://条件三
{
self.tableView.hidden = YES;
_titleView.hidden = NO;
_billNumberView.hidden = YES;
}
break;
default:
break;
}
}
- (void)clearBolt{
if (_titleFiled.text.length > 0) {
_titleFiled.text = @"";
}
if (_billFiled.text.length > 0) {
_billFiled.text = @"";
}
if (_currentIndexPath) {
_currentIndexPath = nil;
[self.tableView reloadData];
}
if ([self.delegate respondsToSelector:@selector(clearBoltInformation)]) {
[self.delegate clearBoltInformation];
}
}
#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 {
static NSString *cellID = @"MaskID";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[MaskCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID totalWidth: ScreenSize.width - 80 totalHeight:TableHeight];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (_dataArr.count > 0) {
cell.Commitbtn.hidden = YES;
[cell setTitleStr:self.dataArr[indexPath.row]];
}
if (_currentIndexPath) {
if (indexPath.row == _currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//获取选中的cell
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
NSString *stateStr = @"";
if (indexPath.row == 0) {
stateStr = @"none";
}else if(indexPath.row == 1){
stateStr = PURCHASENOTICE_STATE_INITIAL;
}else if(indexPath.row == 2){
stateStr = PURCHASENOTICE_STATE_NOTACCEPTED;
}else if(indexPath.row == 3){
stateStr = PURCHASENOTICE_STATE_PURCHASEING;
}else if(indexPath.row == 4){
stateStr = PURCHASENOTICE_STATE_FINISHED;
}
[self.delegate getBoltValueSelectRow:stateStr];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[self keyBoardHidden];
return YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self keyBoardHidden];
}
- (void)keyBoardHidden{
[self.titleFiled resignFirstResponder];
[self.billFiled resignFirstResponder];
}
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.titleFiled) {
if (self.titleFiled.text.length > 0) {
[self.delegate getTitleLike:self.titleFiled.text];
}
}else if(textField == self.billFiled){
if (self.billFiled.text.length > 0) {
[self.delegate getBillNumber:self.billFiled.text];
}
}
}
@end
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