Commit bdc0ca20 authored by 陈俊俊's avatar 陈俊俊

问题修改

parent fe75163d
......@@ -2494,7 +2494,7 @@ acceptTypeJson:YES
NSLog(@"%@",encodeUrlStr);
[self POST:encodeUrlStr
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
......
......@@ -18,6 +18,7 @@ typedef void(^ChoseBaseInfo)(NSArray *baseInfos);
@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)NSMutableArray *indexArr;
@property (nonatomic,strong)NSMutableArray *selectArr;//别的页面传过来
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)UITextField *selectTextFiled;
@property (nonatomic,strong)NSIndexPath *currentIndexPath;
......@@ -25,11 +26,12 @@ typedef void(^ChoseBaseInfo)(NSArray *baseInfos);
@property (nonatomic,assign) BOOL isRefresh;
@property (nonatomic,copy)ChoseBaseInfo choseBaseInfo;
@property (nonatomic,assign)BOOL isFirst;
@property (nonatomic,strong)NSString *selectStr;
- (void)endRefreshing;
- (void)getBaseDataFromServer;
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath;
- (void)deleteTextFieldStr;
- (void)fetchDataList:(NSString *)titleStr tableStr:(NSString *)tableStr;
- (void)tableViewRefresh;
- (void)tableViewRefresh:(NSString *)titltstr;
@end
......@@ -24,7 +24,10 @@
- (void)initData{
self.dataArr = [NSMutableArray array];
if (!self.indexArr) {
self.indexArr = [NSMutableArray array];
}
self.isFirst = YES;
}
......@@ -93,15 +96,20 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
if (![self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
[self.indexArr addObject:indexPath];
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
[self.indexArr removeObject:indexPath];
}
}else{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:self.currentIndexPath];
currentCell.Commitbtn.hidden = YES;
currentCell.titleLabel.textColor = [UIColor blackColor];
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.titleLabel.textColor = BASESELECT_COLOR;
cell.Commitbtn.hidden = NO;
self.currentIndexPath = indexPath;
}
......@@ -137,7 +145,7 @@
// NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
// [self fetchDataList:tilkeStr];
}
- (void)tableViewRefresh{
- (void)tableViewRefresh:(NSString *)titltstr{
self.currentIndexPath = nil;
if (self.indexArr.count > 0) {
[self.indexArr removeAllObjects];
......@@ -147,11 +155,20 @@
- (void)fetchDataList:(NSString *)titleStr tableStr:(NSString *)tableStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = @"";
if ([tableStr isEqualToString:GXF_BASECLASS_USER]) {
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' AND ENABLED = 1 ORDER BY %@", tableStr,titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE ENABLED = 1 ORDER BY %@", tableStr, @"uuid"];
}
}else{
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", tableStr,titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", tableStr, @"uuid"];
}
}
return [db executeQuery:sql];
};
......@@ -167,7 +184,8 @@
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
[self tableViewRefresh:titleStr];
}
};
......
......@@ -193,4 +193,7 @@
#define NOTICE_PERMISSIONS_FINISH @"500306"//结束
//选中的颜色
#define BASESELECT_COLOR RGBA(255, 127, 0, 1)
#endif
......@@ -125,7 +125,7 @@
case kFunctionNewSurvey://新建行情
{
NewSurveyViewController *svc = [[NewSurveyViewController alloc] init];
svc.title = [IBTCommon localizableString:@"AddSurvey"];
svc.navTitle = @"新建行情调研";
[self PushViewController:svc animated:YES];
}
break;
......@@ -182,7 +182,14 @@
[self PushViewController:tVC animated:YES];
}
break;
case kFunctionExaminePurchase:
{
PurchaseViewController *tVC = [[PurchaseViewController alloc] init];
tVC.title = @"审核采购单";
tVC.assessorState = PURCHASE_STATE_SUBMITTED;
[self PushViewController:tVC animated:YES];
}
break;
// case kFunctionPatrolPlan://巡店计划
// {
// ICRPatrolPlanViewController *pVC = [[ICRPatrolPlanViewController alloc] initWithStore:nil isHomeShow:YES];
......
......@@ -41,11 +41,17 @@
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
if (self.dataArr.count > 0) {
NSString *type = self.dataArr[indexPath.row];
......@@ -56,8 +62,12 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:self.currentIndexPath];
currentCell.Commitbtn.hidden = YES;
currentCell.titleLabel.textColor = [UIColor blackColor];
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
self.currentIndexPath = indexPath;
}
- (void)didReceiveMemoryWarning {
......
......@@ -48,18 +48,28 @@
if (self.isMoreChose) {
if ([self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}
if (self.dataArr.count > 0) {
......@@ -80,6 +90,27 @@
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_PRODUCTUNIT];
}
- (void)tableViewRefresh:(NSString *)titltstr{
if (titltstr.length > 0) {
[super tableViewRefresh:titltstr];
}else{
if (self.selectStr.length>0) {
if (!self.isMoreChose) {
for (NSInteger i = 1;i< self.dataArr.count; i++) {
GXFProductUnit *type = self.dataArr[i];
if ([type.uuid isEqualToString:self.selectStr]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
self.currentIndexPath = indexPath;
break;
}
}
[self.tableView reloadData];
}
}else{
[super tableViewRefresh:titltstr];
}
}
}
- (void)didReceiveMemoryWarning {
......
......@@ -49,18 +49,24 @@
if (self.isMoreChose) {
if ([self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}
if (self.dataArr.count > 0) {
......@@ -70,7 +76,6 @@
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Product *product = self.dataArr[indexPath.row];
cell.titleLabel.textColor = GXF_LEFTSIX_COLOR;
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
[cell setTitleStr:proStr];
}
......@@ -81,6 +86,40 @@
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_PRODUCT];
}
- (void)tableViewRefresh:(NSString *)titltstr{
if (titltstr.length > 0) {
[super tableViewRefresh:titltstr];
}else{
if (self.selectArr.count > 0) {
if (self.isMoreChose) {
for (NSInteger i = 1;i< self.dataArr.count; i++) {
Product *product = self.dataArr[i];
for (NSString *selectProduct in self.selectArr) {
if ([selectProduct isEqualToString:product.uuid]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
[self.indexArr addObject:indexPath];
break;
}
}
}
}else{
for (NSInteger i = 1;i< self.dataArr.count; i++) {
Product *product = self.dataArr[i];
for (NSString *selectProduct in self.selectArr) {
if ([selectProduct isEqualToString:product.uuid]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
self.currentIndexPath = indexPath;
break;
}
}
}
}
[self.tableView reloadData];
}else{
[super tableViewRefresh:titltstr];
}
}
}
- (void)didReceiveMemoryWarning {
......
......@@ -24,6 +24,19 @@
[self.dataArr addObject:@"普通"];
self.selectTextFiled = nil;
self.tableView.frame = CGRectMake(0, 5, ScreenSize.width, ScreenSize.height - 64 - 5);
if (self.selectStr.length>0) {
if (!self.isMoreChose) {
for (NSInteger i = 0;i< self.dataArr.count; i++) {
NSString *type = self.dataArr[i];
if ([type isEqualToString:self.selectStr]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
self.currentIndexPath = indexPath;
break;
}
}
[self.tableView reloadData];
}
}
}
- (void)createRefresh{}
......@@ -41,11 +54,17 @@
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
if (self.dataArr.count > 0) {
NSString *type = self.dataArr[indexPath.row];
......@@ -56,10 +75,15 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:self.currentIndexPath];
currentCell.Commitbtn.hidden = YES;
currentCell.titleLabel.textColor = [UIColor blackColor];
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
self.currentIndexPath = indexPath;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -58,18 +58,28 @@
if (self.isMoreChose) {
if ([self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}
if (self.dataArr.count > 0) {
......@@ -89,6 +99,31 @@
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_VENDOR];
}
- (void)tableViewRefresh:(NSString *)titltstr{
if (titltstr.length > 0) {
[super tableViewRefresh:titltstr];
}else{
if (self.selectStr.length>0) {
if (!self.isMoreChose) {
for (NSInteger i = 1;i< self.dataArr.count; i++) {
Vendor *type = self.dataArr[i];
if ([type.uuid isEqualToString:self.selectStr]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
self.currentIndexPath = indexPath;
break;
}
}
[self.tableView reloadData];
}
}else{
[super tableViewRefresh:titltstr];
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -58,11 +58,17 @@
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
if (self.dataArr.count > 0) {
if (indexPath.row == 0) {
......@@ -84,7 +90,27 @@
[self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_WAREHOUSE];
}
- (void)tableViewRefresh:(NSString *)titltstr{
if (titltstr.length > 0) {
[super tableViewRefresh:titltstr];
}else{
if (self.selectStr.length>0) {
if (!self.isMoreChose) {
for (NSInteger i = 1;i< self.dataArr.count; i++) {
Warehouse *type = self.dataArr[i];
if ([type.uuid isEqualToString:self.selectStr]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
self.currentIndexPath = indexPath;
break;
}
}
[self.tableView reloadData];
}
}else{
[super tableViewRefresh:titltstr];
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -84,20 +84,26 @@
if (self.isMoreChose) {
if ([self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
if (self.currentIndexPath) {
if (indexPath.row == self.currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
cell.titleLabel.textColor = BASESELECT_COLOR;
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}else{
cell.Commitbtn.hidden = YES;
cell.titleLabel.textColor = [UIColor blackColor];
}
}
if (self.dataArr.count > 0) {
if (indexPath.row == 0) {
NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
......@@ -105,7 +111,7 @@
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
User *user = self.dataArr[indexPath.row];
[cell setTitleStr:user.name];
[cell setTitleStr:[NSString stringWithFormat:@"%@[%@]",user.name,user.login]];
}
}
return cell;
......@@ -115,6 +121,40 @@
[self fetchDataList:tilkeStr tableStr:GXF_BASECLASS_USER];
}
- (void)tableViewRefresh:(NSString *)titltstr{
if (titltstr.length > 0) {
[super tableViewRefresh:titltstr];
}else{
if (self.selectArr.count > 0) {
if (self.isMoreChose) {
for (NSInteger i = 1;i< self.dataArr.count; i++) {
User *user = self.dataArr[i];
for (NSString * surverUuid in self.selectArr) {
if ([user.uuid isEqualToString:surverUuid]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
[self.indexArr addObject:indexPath];
break;
}
}
}
}else{
for (NSInteger i = 1;i< self.dataArr.count; i++) {
User *user = self.dataArr[i];
for (NSString * surverUuid in self.selectArr) {
if ([user.uuid isEqualToString:surverUuid]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
self.currentIndexPath = indexPath;
break;
}
}
}
}
[self.tableView reloadData];
}else{
[super tableViewRefresh:titltstr];
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -16,6 +16,6 @@
@interface FooterCell : UIView
- (instancetype)initWithFrame:(CGRect)frame withTitle:(NSString *)title isTwo:(NSString *)twoTitle;
@property (nonatomic,strong)id<FooterCellDelegate>delegate;
@property (nonatomic,weak)id<FooterCellDelegate>delegate;
@end
......@@ -8,7 +8,15 @@
#import <UIKit/UIKit.h>
@protocol GXFPopViewDelegate <NSObject>
- (void)selectRowTitle:(NSString *)str;
- (void)clearFromSuper;
@end
@interface GXFPopView : UIView
@property (nonatomic,weak)id<GXFPopViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)titleArr;
@end
......@@ -55,6 +55,7 @@
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0, CGRectGetHeight(bgView.frame)- GXFPOpView_TopHeight, CGRectGetWidth(bgView.frame), GXFPOpView_TopHeight);
[btn setTitle:@"返回" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
[btn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
[bgView addSubview:btn];
......@@ -81,7 +82,16 @@
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *str = self.titleArr[indexPath.row];
if ([self.delegate respondsToSelector:@selector(selectRowTitle:)]) {
[self.delegate selectRowTitle:str];
}
}
- (void)backClick{
if ([self.delegate respondsToSelector:@selector(clearFromSuper)]) {
[self.delegate clearFromSuper];
}
}
@end
......@@ -8,8 +8,17 @@
#import <UIKit/UIKit.h>
@protocol HeaderCellDelegate <NSObject>
@optional
- (void)addClickList;
@end
@interface HeaderCell : UIView
@property (nonatomic,weak)id<HeaderCellDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr;
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr withHiddenEdit:(BOOL)isHiddenEdit;
@end
......@@ -14,7 +14,7 @@
@interface HeaderCell ()
@property (nonatomic,strong)NSArray *arr;
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,assign)BOOL isHiddenAdd;
@end
@implementation HeaderCell
......@@ -27,6 +27,17 @@
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr withHiddenEdit:(BOOL)isHiddenEdit{
self = [super initWithFrame:frame];
if (self) {
self.arr = arr;
self.isHiddenAdd = isHiddenEdit;
[self bulidLayout];
}
return self;
}
- (void)bulidLayout{
CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count;
......@@ -43,5 +54,24 @@
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.lineLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:self.lineLabel];
if (!self.isHiddenAdd) {
UIButton *addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
addBtn.frame = CGRectMake(ScreenSize.width - LeftWidth - SpaceMargin, 0, LeftWidth, self.frame.size.height);
[addBtn setImage:[UIImage imageNamed:@"add"] forState:UIControlStateNormal];
[addBtn setTitleColor:GXF_PLACEHOLDER_COLOR forState:UIControlStateNormal];
[addBtn addTarget:self action:@selector(addBtn) forControlEvents:UIControlEventTouchUpInside];
addBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:addBtn];
}
}
- (void)addBtn{
if([self.delegate respondsToSelector:@selector(addClickList)]){
[self.delegate addClickList];
}
}
@end
......@@ -24,7 +24,7 @@ typedef enum : NSUInteger {
CommitTag,
} BtnTag;
@interface NewPurchaseViewController ()<TopPurchaseViewDelegate>
@interface NewPurchaseViewController ()<TopPurchaseViewDelegate,UIAlertViewDelegate>
{
UIScrollView *_scrollView;
TopPurchaseView *_purchaseView;
......@@ -37,6 +37,10 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)NSString *state;
@property (nonatomic,strong)GXFPopView *popView;
@end
@implementation NewPurchaseViewController
......@@ -101,6 +105,8 @@ typedef enum : NSUInteger {
//赋值
- (void)prepareDataInCell{
_purchaseView.bill = self.purchaseBill;
NSMutableArray *arr = [NSMutableArray array];
for (NSDictionary *productDict in self.purchaseBill.products) {
PurchaseBillProduct *billProduct = [[PurchaseBillProduct alloc]init];
......@@ -211,8 +217,9 @@ typedef enum : NSUInteger {
break;
case CommitTag:{
if ([self checkPurchase]) {
[self getDataFromServer:PURCHASE_STATE_SUBMITTED msg:@"正在提交..."];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认提交" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
[alertView show];
}
}
break;
......@@ -262,8 +269,7 @@ typedef enum : NSUInteger {
versionObject = self.purchaseBill.version;
}
NSMutableArray *billProducts = [NSMutableArray array];
for (PurchaseBillProduct *billProduct in _pvc.productArr) {
[billProducts addObject:[billProduct dictForCommit]];
for (PurchaseBillProduct *billProduct in _pvc.productArr) { [billProducts addObject:[billProduct dictForCommit]];
}
self.state = state;
NSDictionary *dict = @{@"uuid":uuidObject,
......@@ -309,6 +315,21 @@ typedef enum : NSUInteger {
ShowMessage(@"金额不能为空");
return NO;
}
for (PurchaseBillProduct *billProduct in _pvc.productArr) {
if ([billProduct.qty integerValue] <= 0 || [billProduct.baseQty integerValue] <= 0) {
ShowMessage(@"有数量等于0的商品明细,请编辑后保存");
return NO;
}
if ([billProduct.price integerValue] <=0 || [billProduct.basePrice integerValue] <= 0) {
ShowMessage(@"有价格未填写的商品明细,请编辑后保存");
return NO;
}
if (billProduct.remark.length <= 0 ) {
ShowMessage(@"商品备注为空,请编辑后保存");
return NO;
}
}
return YES;
}
......@@ -371,7 +392,7 @@ typedef enum : NSUInteger {
billProduct.baseQty = [NSNumber numberWithFloat:0];
billProduct.basePrice = [NSNumber numberWithFloat:0];
billProduct.total = [NSNumber numberWithFloat:0];
billProduct.remark = product.remark;
billProduct.remark = @"";
#warning 包装规格说明是不是少了在NoticeProduct
billProduct.qpcStr = @"无";
[billArr addObject:billProduct];
......@@ -394,6 +415,12 @@ typedef enum : NSUInteger {
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
[self getDataFromServer:PURCHASE_STATE_SUBMITTED msg:@"正在提交..."];//提交
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -14,7 +14,7 @@
#define TableHeight 44
#define ShowHeight 110
@interface ProductBillViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
@interface ProductBillViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,HeaderCellDelegate>
{
CGRect _tableFrame;
NSMutableArray *_selectRowArr;//记录当前选中的cell
......@@ -52,8 +52,9 @@
NSArray *arr = @[@"商品",@"单价",@"包装数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:self.isHiddenEdit];
[self.view addSubview:headCell];
headCell.delegate = self;
self.tableView.tableHeaderView = headCell;
if (!self.isHiddenEdit) {
......@@ -63,6 +64,12 @@
self.tableView.tableFooterView = footCell;
}
}
- (void)addClickList{
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil];
}
#pragma mark - footerDelegate
- (void)addClick{
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil];
......
......@@ -25,7 +25,7 @@ typedef enum : NSUInteger {
} BtnTag;
@interface PurchaseDetailViewController ()
@interface PurchaseDetailViewController ()<UIAlertViewDelegate>
{
UIScrollView *_scrollView;
UIView *_purchaseView;
......@@ -206,13 +206,19 @@ typedef enum : NSUInteger {
case CancleTag:
{
CLog(@"作废");
[self dealByAction:PURCHASE_ACTION_ABORT];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认作废" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
alertView.tag = CancleTag;
[alertView show];
}
break;
case EndTag:
{
CLog(@"结束");
[self dealByAction:PURCHASE_ACTION_FINISH];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认结束" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
alertView.tag = EndTag;
[alertView show];
}
break;
case RejectTag:
......@@ -353,7 +359,7 @@ typedef enum : NSUInteger {
self.stateLabel.text = @"未提交";
}else if ([self.bill.state isEqualToString:PURCHASE_STATE_SUBMITTED]) {
self.stateLabel.textColor = [UIColor greenColor];
self.stateLabel.text = @"审批";
self.stateLabel.text = @"审批";
}else if ([self.bill.state isEqualToString:PURCHASE_STATE_REJECTED]) {
self.stateLabel.textColor = [UIColor grayColor];
self.stateLabel.text = @"已拒绝";
......@@ -372,7 +378,7 @@ typedef enum : NSUInteger {
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.noteLabel.text = [NSString stringWithFormat:@"%@",self.bill.remark?self.bill.remark:@"无"];
self.lastModifyNameLabel.text = [IBTCommon checkString:self.bill.lastModify_operName];
NSString *type = [self.bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
self.typeLabel.text = type;
......@@ -412,8 +418,18 @@ typedef enum : NSUInteger {
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (alertView.tag == CancleTag) {
if (buttonIndex == 1) {
[self dealByAction:PURCHASE_ACTION_ABORT];//作废
}
}else if (alertView.tag == EndTag){
if (buttonIndex == 1) {
[self dealByAction:PURCHASE_ACTION_FINISH];//结束
}
}
}
- (void)didReceiveMemoryWarning {
......
......@@ -10,4 +10,6 @@
@interface PurchaseViewController : ICRBaseViewController
@property (nonatomic,strong)NSString *assessorState;//从审核采购单跳转过来的
@end
......@@ -65,34 +65,9 @@ typedef enum : NSUInteger {
}
- (void)initData{
self.dataArr = [NSMutableArray array];
// for (NSInteger i = 0; i < 6; i++) {
// PurchaseBill *bill = [PurchaseBill new];
// bill.billNumber = @"150903000013";
// bill.noticeNumber = @"134594059654";
// bill.create_operName = @"创建人";
// bill.create_time = @"2013-03-04";
// bill.vendor_name = @"供应商";
// bill.total = [NSNumber numberWithFloat:22];
// bill.charge = [NSNumber numberWithFloat:333];
// bill.remark = @"备注";
// bill.lastModify_operName = @"最后修改人";
// bill.vendorConfirmTime = @"否";
//
// if (i == 0) {
// bill.state = @"initial";
// }else if(i == 1){
// bill.state = @"submitted";
// }else if(i == 2){
// bill.state = @"rejected";
// }else if(i == 3){
// bill.state = @"approved";
// }else if(i == 4){
// bill.state = @"shipping";
// }else if(i == 5){
// bill.state = @"finished";
// }
// [self.dataArr addObject:bill];
// }
if (self.assessorState.length > 0) {
self.state = self.assessorState;
}
}
- (void)getData{
[ICRUserUtil sharedInstance].needFresh = NO;
......
......@@ -150,12 +150,12 @@
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",billProduct.price];
self.showBasePriceLabel.text = [NSString stringWithFormat:@"基础单价:%@元",billProduct.basePrice];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",billProduct.total];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",billProduct.remark];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",billProduct.remark ? billProduct.remark :@"无" ];
[self isShowShippingQty:billProduct];
}
- (void)isShowShippingQty:(PurchaseBillProduct *)billProduct{
if(billProduct.shippedQty){
if(self.editBtn.hidden){
self.showShippedFlag = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showBasePriceLabel.frame), ShowWidth, ShowHeight))];
self.showShippedFlag.textAlignment = NSTextAlignmentLeft;
self.showShippedFlag.textColor = GXF_PLACEHOLDER_COLOR;
......
......@@ -277,17 +277,17 @@
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.billFiled) {
if (self.billFiled.text.length > 0) {
// if (self.billFiled.text.length > 0) {
[self.delegate getbillLike:self.billFiled.text];
}
// }
}else if(textField == self.titleFiled){
if (self.titleFiled.text.length > 0) {
// if (self.titleFiled.text.length > 0) {
[self.delegate gettitleLike:self.titleFiled.text];
}
// }
}else if(textField == self.vendorFiled){
if (self.vendorFiled.text.length > 0) {
// if (self.vendorFiled.text.length > 0) {
[self.delegate getvendorLike:self.vendorFiled.text];
}
// }
}
}
......
......@@ -23,6 +23,10 @@
UITableView *_tableView;
NSMutableArray *_dataArr;
}
//选择的项目
@property (nonatomic,strong)NSString *selectType;
@property (nonatomic,strong)NSString *selectVendor;
@property (nonatomic,strong)NSString *selectWarehouse;
@end
......@@ -153,6 +157,8 @@
self.purchaseTypeLabel.text = type;
self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR;
self.type = bill.type;
self.selectType = type;
}
if (bill.vendor_name.length > 0) {
self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",bill.vendor_name,bill.vendor_code];
......@@ -160,6 +166,7 @@
self.vendor_uuid = bill.uuid;
self.vendor_code = bill.vendor_code;
self.vendor_name = bill.vendor_name;
self.selectVendor = bill.vendor_uuid;
}
if (bill.receiveWrh_name.length > 0) {
self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",bill.receiveWrh_name,bill.receiveWrh_code];
......@@ -168,6 +175,8 @@
self.receiveWrh_uuid = bill.receiveWrh_uuid;
self.receiveWrh_code = bill.receiveWrh_code;
self.receiveWrh_name = bill.receiveWrh_name;
self.selectWarehouse = bill.receiveWrh_uuid;
}
if (bill.charge) {
self.otherPriceFiled.text = [bill.charge stringValue];
......@@ -195,6 +204,9 @@
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 2){
ChooseVendorViewController *cvc = [ChooseVendorViewController new];
if (self.selectVendor.length > 0) {
cvc.selectStr = self.selectVendor;
}
cvc.choseBaseInfo = ^(NSArray *vendors){
if (vendors.count > 0) {
Vendor *vendor = vendors[0];
......@@ -203,6 +215,7 @@
self.vendor_uuid = vendor.uuid;
self.vendor_code = vendor.code;
self.vendor_name = vendor.name;
self.selectVendor = vendor.uuid;
}
};
......@@ -210,9 +223,13 @@
[self.delegate pushNextViewController:cvc];
}else if(indexPath.row == 1){
ChooseTypeViewController *tvc = [[ChooseTypeViewController alloc]init];
if (self.selectType.length > 0) {
tvc.selectStr = self.selectType;
}
tvc.choseBaseInfo = ^(NSArray *types){
NSString *type = types[0];
self.purchaseTypeLabel.text = type;
self.selectType = type;
self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR;
if ([type isEqualToString:@"紧急"]) {
self.type = GXF_Critical;
......@@ -223,6 +240,9 @@
[self.delegate pushNextViewController:tvc];
}else if(indexPath.row == 3){
ChooseWarehouseViewController *wvc = [[ChooseWarehouseViewController alloc]init];
if (self.selectWarehouse.length > 0) {
wvc.selectStr = self.selectWarehouse;
}
wvc.choseBaseInfo = ^(NSArray *warehouses){
Warehouse *warehouse = warehouses[0];
self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
......@@ -230,6 +250,7 @@
self.receiveWrh_uuid = warehouse.uuid;
self.receiveWrh_code = warehouse.code;
self.receiveWrh_name = warehouse.name;
self.selectWarehouse = self.receiveWrh_uuid;
};
[self.delegate pushNextViewController:wvc];
}
......
......@@ -13,6 +13,6 @@
@interface FollowUpRecordViewController : ICRBaseViewController
@property (nonatomic,strong)NoticeRecord *noticeRecord;
@property (nonatomic,strong)PurchaseNotice *purchaseNotice;
@property (nonatomic,strong)NSMutableArray *productArr;
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@end
......@@ -22,7 +22,7 @@
[self getDataFromServer];
}
- (void)bulidLayout{
self.productArr=[[NSMutableArray alloc]initWithObjects:@"",@"", nil];
self.dataArr=[[NSMutableArray alloc]init];
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.delegate = self;
......@@ -39,11 +39,12 @@
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
NSDictionary *dictData = data[@"data"];
NSArray *dataArr = data[@"data"];
for (NSDictionary *dataDict in dataArr) {
NoticeRecord *noticeRecord = [[NoticeRecord alloc]init];
[noticeRecord setValuesForKeysWithDictionary:dictData];
self.noticeRecord = noticeRecord;
[noticeRecord setValuesForKeysWithDictionary:dataDict];
[self.dataArr addObject:noticeRecord];
}
[self.tableView reloadData];
}else{
[IBTLoadingView showTips:message];
......@@ -57,7 +58,8 @@
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getPurchaseNoticeRecodWithData:self.purchaseNotice.uuid success:succ failure:fail];
//5a7417014fdfc13a014fe5b890d8000e
[[ICRHTTPController sharedController] getPurchaseNoticeRecodWithData:self.purchaseNotice.purchaserUuid success:succ failure:fail];
}
#pragma mark - 协议方法
......@@ -66,7 +68,7 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.productArr.count;
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"NotuceRecordCell";
......@@ -77,7 +79,10 @@
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
notuceRecordCell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (self.dataArr.count > 0) {
NoticeRecord *recode = self.dataArr[indexPath.row];
notuceRecordCell.noticeRecode = recode;
}
return notuceRecordCell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
......
......@@ -37,8 +37,9 @@ typedef enum : NSUInteger {
SaveTag = 8000,
CommitTag,
} BtnTag;
@interface NewPurchaseNoticeViewController()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,HPGrowingTextViewDelegate>
@interface NewPurchaseNoticeViewController()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,HPGrowingTextViewDelegate,UIAlertViewDelegate>
{
NSString *_clickState;
UITableView *_tableView;
NSMutableArray *_dataArr;
NSMutableArray *_shopeArr;
......@@ -65,7 +66,9 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)UILabel *HeardLabel;
@property (nonatomic,strong)UILabel *FootLabel;
@property (nonatomic,strong)UIButton *addDetailedButton;
@property (nonatomic,strong)NSMutableArray *selectUsers;
@property (nonatomic,strong)NSString *purchaseNoticeUuid;
@end
......@@ -80,6 +83,7 @@ typedef enum : NSUInteger {
billNumberObject = [NSNull null];
versionObject = [NSNumber numberWithInteger:0];
if (self.purchaseNotice) {
self.purchaseNoticeUuid = self.purchaseNotice.uuid;
[self getDataFromServer];
}
}
......@@ -109,7 +113,7 @@ typedef enum : NSUInteger {
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getPurchaseNoticeDetailedWithPurchaseUuid:self.purchaseNotice.uuid success:succ failure:fail];
[[ICRHTTPController sharedController] getPurchaseNoticeDetailedWithPurchaseUuid:self.purchaseNoticeUuid success:succ failure:fail];
}
- (void)prepareDataInCell{
if (self.purchaseNotice) {
......@@ -123,6 +127,7 @@ typedef enum : NSUInteger {
self.purchaseUuidStr = self.purchaseNotice.purchaserUuid;
self.purchaseCodeStr = self.purchaseNotice.purchaserCode;
self.purchaseNameStr = self.purchaseNotice.purchaserName;
[self.selectUsers addObject:self.purchaseNotice.purchaserUuid];
}
if (self.purchaseNotice.remark) {
_noteTextView.text = self.purchaseNotice.remark;
......@@ -144,6 +149,8 @@ typedef enum : NSUInteger {
-(void)setupSubviews
{
selectCellAry=[[NSMutableArray alloc]initWithCapacity:1000];
self.selectUsers = [NSMutableArray array];
_dataArr=[[NSMutableArray alloc]initWithObjects:@"标题:",@"采购员:",@"备注:", nil];
_shopeArr=[[NSMutableArray alloc]initWithObjects: nil];
self.view.backgroundColor = XXFBgColor;
......@@ -185,6 +192,14 @@ typedef enum : NSUInteger {
[footView2 addSubview:lable];
}
UIButton *addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
addBtn.frame = CGRectMake(ScreenSize.width - LeftWidth - SpaceMargin, 0, LeftWidth, 40);
[addBtn setImage:[UIImage imageNamed:@"add"] forState:UIControlStateNormal];
[addBtn setTitleColor:GXF_PLACEHOLDER_COLOR forState:UIControlStateNormal];
[addBtn addTarget:self action:@selector(addShopeDetailed) forControlEvents:UIControlEventTouchUpInside];
addBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[footView2 addSubview:addBtn];
UIView *footView3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
footView3.backgroundColor=[UIColor clearColor];
self.addDetailedButton=[UIButton buttonWithType: UIButtonTypeCustom];
......@@ -245,7 +260,7 @@ typedef enum : NSUInteger {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([tableView isEqual:_tableView]) {
static NSString *cellID = @"cellID";
static NSString *cellID = @"SurveyCell";
SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
......@@ -262,7 +277,7 @@ typedef enum : NSUInteger {
}else if ([tableView isEqual:mingXiTableView])
{
static NSString *CellID = @"CellID";
static NSString *CellID = @"PurchaseNoticeCell";
PurchaseNoticeCell *Cell = [tableView dequeueReusableCellWithIdentifier:CellID];
if (Cell == nil) {
Cell = [[PurchaseNoticeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
......@@ -313,15 +328,21 @@ typedef enum : NSUInteger {
if(indexPath.row == 1){
ChosePersonViewController *cvc = [ChosePersonViewController new];
if (self.selectUsers.count > 0) {
cvc.selectArr = self.selectUsers;
}
cvc.choseBaseInfo = ^(NSArray *users){
if (users.count > 0) {
if (self.selectUsers.count > 0) {
[self.selectUsers removeAllObjects];
}
SurveyUser *user = users[0];
_personLabel.text = user.userName;
_personLabel.textColor = GXF_CONTENT_COLOR;
self.purchaseNameStr = user.userName;
self.purchaseCodeStr = user.userCode;
self.purchaseUuidStr = user.userUuid;
[self.selectUsers addObject:user.userUuid];
}
};
cvc.isMoreChose = NO;
......@@ -425,7 +446,7 @@ typedef enum : NSUInteger {
- (void)didtoucher:(UIButton*)button
{
NoticeProductViewController *nvc = [NoticeProductViewController new];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:button.tag];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:button.tag inSection:0];
NoticeProduct *shopDetail=[_shopeArr objectAtIndex:button.tag];
if (indexPath) {
......@@ -464,6 +485,7 @@ typedef enum : NSUInteger {
case SaveTag:
{
if ([self checkSurvey]) {
_clickState = PURCHASENOTICE_STATE_INITIAL;
[self saveSurvey:PURCHASENOTICE_STATE_INITIAL message:@"正在保存..."];
}
}
......@@ -471,7 +493,9 @@ typedef enum : NSUInteger {
case CommitTag:
{
if ([self checkSurvey]) {
[self saveSurvey:PURCHASENOTICE_STATE_NOTACCEPTED message:@"正在提交..."];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认提交" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
[alertView show];
}
}
break;
......@@ -515,6 +539,10 @@ typedef enum : NSUInteger {
billNumberObject = billNumberS;
versionObject = versionN;
[IBTLoadingView showTips:[NSString stringWithFormat:@"当前单据%@已保存成功",billNumberS]];
//成功之后在次请求详情数据
self.purchaseNoticeUuid = uuidS;
[self getDataFromServer];
}else{//提交成功
PurchaseNoticeViewController *svc = [PurchaseNoticeViewController new];
[self PushViewController:svc animated:YES];
......@@ -556,6 +584,20 @@ typedef enum : NSUInteger {
[IBTLoadingView showProgressLabel:msg];
[[ICRHTTPController sharedController] savePurchaseNoticeWithData:dict success:succ failure:fail];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
_clickState = PURCHASENOTICE_STATE_NOTACCEPTED;
[self saveSurvey:PURCHASENOTICE_STATE_NOTACCEPTED message:@"正在提交..."];
}
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
if(self.purchaseNotice && [_clickState isEqualToString:PURCHASENOTICE_STATE_INITIAL]){
[ICRUserUtil sharedInstance].needFresh = YES;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -32,7 +32,7 @@ typedef enum : NSUInteger {
} BtnTag;
@interface SeePurchaseNoticeViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@interface SeePurchaseNoticeViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,UIAlertViewDelegate>
{
UIScrollView *_scrollView;
......@@ -157,14 +157,6 @@ typedef enum : NSUInteger {
[self.view addSubview:_endBtn];
if ([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_NOTACCEPTED]) {
if ([self checkIsPermission:NOTICE_PERMISSIONS_ACCEPTTASK] && [self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]) {
_rejectBtn.tag = AcceptTag;
[_rejectBtn setTitle:@"接受任务" forState:UIControlStateNormal];
_endBtn.tag = NewTag;
_endBtn.backgroundColor = [UIColor lightGrayColor];
_endBtn.enabled = NO;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
}else{
if ([self checkIsPermission:NOTICE_PERMISSIONS_ACCEPTTASK]) {
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
......@@ -178,8 +170,13 @@ typedef enum : NSUInteger {
}else{
[self hiddenBottomBtn];
}
}
}else if([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_PURCHASEING]){
if ([self checkIsPermission:NOTICE_PERMISSIONS_FINISH] && [self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]) {
_rejectBtn.tag = EndTag;
[_rejectBtn setTitle:@"结束" forState:UIControlStateNormal];
_endBtn.tag = NewTag;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
}else{
if([self checkIsPermission:NOTICE_PERMISSIONS_FINISH]){
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
......@@ -193,6 +190,7 @@ typedef enum : NSUInteger {
}else{
[self hiddenBottomBtn];
}
}
}else if([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_FINISHED]) {
[self hiddenBottomBtn];
}
......@@ -211,7 +209,9 @@ typedef enum : NSUInteger {
case EndTag:
{
[self dealByAction:@"end"];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认结束" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
[alertView show];
}
break;
case NewTag:
......@@ -241,10 +241,12 @@ typedef enum : NSUInteger {
if (success == 1) {
if ([action isEqualToString:@"accept"]) {
_stateLabel.text = @"发运中";
_endBtn.enabled = YES;
_endBtn.backgroundColor = GXF_COMMIT_COLOR;
_rejectBtn.enabled = NO;
_rejectBtn.backgroundColor = [UIColor lightGrayColor];
_endBtn.hidden = YES;
_rejectBtn.hidden = NO;
[_rejectBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
_rejectBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_rejectBtn.tag = NewTag;
[ICRUserUtil sharedInstance].needFresh = YES;
}else{
[ICRUserUtil sharedInstance].needFresh = YES;
[self PopViewControllerAnimated:YES];
......@@ -509,7 +511,7 @@ typedef enum : NSUInteger {
Cell.packageQuantity.text=[NSString stringWithFormat:@"%@%@",noticeProduct.qpcQuantity,noticeProduct.packUnit];//包装数量
Cell.YcgslLabel.text=[noticeProduct.purchasedQuantity stringValue];//已采购数量
Cell.foundationQuantity.text=[NSString stringWithFormat:@"%@%@",noticeProduct.quantity,noticeProduct.baseUnit];//基础数量
Cell.remark.text=noticeProduct.remark;//备注
Cell.remark.text= [NSString stringWithFormat:@"%@",noticeProduct.remark?noticeProduct.remark:@"无"];//备注
if (Cell.YcgslLabel.text==nil) {
Cell.YcgslLabel.text=@"0";//已采购数量
}
......@@ -544,6 +546,13 @@ typedef enum : NSUInteger {
[self PushViewController:nvc animated:YES];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
[self dealByAction:@"end"];//结束
}
}
/*
#pragma mark - Navigation
......
......@@ -266,13 +266,13 @@
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.titleFiled) {
if (self.titleFiled.text.length > 0) {
// if (self.titleFiled.text.length > 0) {
[self.delegate getTitleLike:self.titleFiled.text];
}
// }
}else if(textField == self.billFiled){
if (self.billFiled.text.length > 0) {
// if (self.billFiled.text.length > 0) {
[self.delegate getBillNumber:self.billFiled.text];
}
// }
}
}
......
......@@ -23,7 +23,7 @@ typedef enum : NSUInteger {
SaveTag,
} BtnTag;
@interface NoticeProductViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
@interface NoticeProductViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate,UIAlertViewDelegate>
{
UITableView *_tableView;
NSMutableArray *_dataArr;
......@@ -43,6 +43,9 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productUuidStr;
@property (nonatomic,strong)NSString *productQpcStr;//商品规格描述
@property (nonatomic,strong)NSMutableArray *selectProducts;
@property (nonatomic,strong)NSString *selectUnit;
@end
@implementation NoticeProductViewController
......@@ -57,11 +60,12 @@ typedef enum : NSUInteger {
- (void)initData{
_dataArr = [NSMutableArray array];
self.selectProducts = [NSMutableArray array];
[_dataArr addObject:@"商品"];
[_dataArr addObject:@"包装单位"];
[_dataArr addObject:@"包装规格"];
[_dataArr addObject:@"包装数量"];
[_dataArr addObject:@"基础数量"];
[_dataArr addObject:@"包装数量[计划]"];
[_dataArr addObject:@"基础数量[计划]"];
[_dataArr addObject:@"备注"];
}
......@@ -92,12 +96,9 @@ typedef enum : NSUInteger {
switch (btn.tag) {
case deleteTag://删除
{
if (self.indexPath) {
self.deleteNoticeProduct(self.noticeProduct,self.indexPath);
[self PopViewControllerAnimated:YES];
}else{
[self clearInfomation];
}
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认删除" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
[alertView show];
}
break;
case SaveTag:
......@@ -112,6 +113,16 @@ typedef enum : NSUInteger {
break;
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
if (self.indexPath) {
self.deleteNoticeProduct(self.noticeProduct,self.indexPath);
[self PopViewControllerAnimated:YES];
}else{
[self clearInfomation];
}
}
}
- (void)clearInfomation{
_chooseCostLabel.text = @"选择商品";
_chooseCostLabel.textColor = GXF_PLACEHOLDER_COLOR;
......@@ -144,6 +155,11 @@ typedef enum : NSUInteger {
ShowMessage(@"基础数量不能为空");
return NO;
}
if (_noteTextView.text.length == 0) {
ShowMessage(@"备注不能为空");
return NO;
}
if (!self.noticeProduct) {
self.noticeProduct = [[NoticeProduct alloc]init];
}
......@@ -202,14 +218,18 @@ typedef enum : NSUInteger {
_noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableRowHeight)];
_noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
_noteTextView.minNumberOfLines = 1;
_noteTextView.maxNumberOfLines = 1;
_noteTextView.isScrollable = YES;
_noteTextView.maxNumberOfLines = 4;
// _noteTextView.isScrollable = YES;
_noteTextView.font = GXF_FIFTEENTEN_SIZE;
_noteTextView.textAlignment = NSTextAlignmentRight;
_noteTextView.delegate = self;
_noteTextView.returnKeyType = UIReturnKeyDone;
_noteTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:_noteTextView];
CGRect lineFrame = cell.lineLabel.frame;
lineFrame.origin.y = TableRowHeight*2-1;
cell.lineLabel.frame = lineFrame;
}else{
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableRowHeight)];
textField.textAlignment = NSTextAlignmentRight;
......@@ -227,6 +247,13 @@ typedef enum : NSUInteger {
if (indexPath.row == 2) {
_qpcLabel = label;
UILabel *labelTwo = [[UILabel alloc]initWithFrame:CGRectMake(100+LeftMargin, 0, 50, TableRowHeight)];
labelTwo.text = @"1*";
labelTwo.textAlignment = NSTextAlignmentRight;
[cell.contentView addSubview:labelTwo];
textField.left = labelTwo.right;
textField.width = textField.width - 50;
label.left = textField.right+ 5;
textField.placeholder = @"输入包装规格";
_qpcField = textField;
}else if(indexPath.row == 3){
......@@ -248,22 +275,33 @@ typedef enum : NSUInteger {
self.productUuidStr = self.noticeProduct.productUuid;
self.productCodeStr = self.noticeProduct.productCode;
self.productNameStr = self.noticeProduct.productName;
[self.selectProducts addObject:self.noticeProduct.productUuid];
_chooseCostLabel.textColor = GXF_CONTENT_COLOR;
_choosePackUnitLabel.text = self.noticeProduct.packUnit;
_choosePackUnitLabel.textColor = GXF_CONTENT_COLOR;
_packCountLabel.text = self.noticeProduct.packUnit;
_baseCountLabel.text = self.noticeProduct.baseUnit;
_qpcLabel.text = self.noticeProduct.baseUnit;
_qpcField.text = [self.noticeProduct.qpc stringValue];
_qpcQuantityField.text = [self.noticeProduct.qpcQuantity stringValue];
_quantityField.text = [self.noticeProduct.quantity stringValue];
_noteTextView.text = self.noticeProduct.remark;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == _dataArr.count - 1) {
return TableRowHeight *2;
}
return TableRowHeight;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 0){
ChooseProductViewController *cvc = [ChooseProductViewController new];
if (self.selectProducts.count > 0) {
cvc.selectArr = self.selectProducts;
}
cvc.choseBaseInfo = ^(NSArray *products){
Product *product=products [0];
_chooseCostLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
......@@ -273,17 +311,25 @@ typedef enum : NSUInteger {
self.productCodeStr = product.code;
_qpcLabel.text = product.measureUnit;
_baseCountLabel.text = _qpcLabel.text;
if (self.selectProducts.count > 0) {
[self.selectProducts removeAllObjects];
}
[self.selectProducts addObject:product.uuid];
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
}else if(indexPath.row == 1){
ChooseProductUnitViewController *cvc = [ChooseProductUnitViewController new];
if (self.selectUnit.length > 0) {
cvc.selectStr = self.selectUnit;
}
cvc.choseBaseInfo = ^(NSArray *products){
if (products.count > 0) {
GXFProductUnit *productUnit=products [0];
_choosePackUnitLabel.text = [NSString stringWithFormat:@"%@",productUnit.name];
_choosePackUnitLabel.textColor = GXF_CONTENT_COLOR;
_packCountLabel.text = productUnit.name;
self.selectUnit = productUnit.name;
}
};
cvc.isMoreChose = NO;
......
......@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "NoticeRecord.h"
@interface NotuceRecordCell : UITableViewCell
@property (nonatomic,strong)UILabel *uuidLable;//唯一标识
......@@ -16,7 +17,7 @@
@property (nonatomic,strong)UILabel *createdLable;//业务时间
@property (nonatomic,strong)UILabel *remarkLable;//日志描述信息
@property (nonatomic,strong)NoticeRecord *noticeRecode;
@end
......@@ -59,9 +59,18 @@
[bgView addSubview:self.remarkLable];
[bgView addSubview:self.typeLable];
[bgView addSubview:self.uuidLable];
}
- (void)setNoticeRecode:(NoticeRecord *)noticeRecode{
self.creatorLable.text = [NSString stringWithFormat:@"%@",noticeRecode.creator];
self.createdLable.text = [NSString stringWithFormat:@"%@",noticeRecode.created];
self.traceIdLable.text = [NSString stringWithFormat:@"采购通知单号:%@",noticeRecode.traceId];
self.typeLable.text = [NSString stringWithFormat:@"类型:%@",noticeRecode.type];
self.remarkLable.text = [NSString stringWithFormat:@"备注:%@",noticeRecode.remark];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
......
......@@ -262,13 +262,13 @@
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.titleFiled) {
if (self.titleFiled.text.length > 0) {
// if (self.titleFiled.text.length > 0) {
[self.delegate getTitleLike:self.titleFiled.text];
}
// }
}else if(textField == self.billFiled){
if (self.billFiled.text.length > 0) {
// if (self.billFiled.text.length > 0) {
[self.delegate getBillNumber:self.billFiled.text];
}
// }
}
}
......
......@@ -31,7 +31,7 @@ typedef enum : NSUInteger {
CommitTag,
} BtnTag;
@interface NewSurveyViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate,StartTimeViewDelegate>
@interface NewSurveyViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate,StartTimeViewDelegate,UIAlertViewDelegate>
{
UITableView *_tableView;
NSMutableArray *_dataArr;
......@@ -57,6 +57,8 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)NSString *endDateStr;
@property (nonatomic,strong)NSString *remarkStr;
@property (nonatomic,strong)NSMutableArray *users;
@property (nonatomic,strong)NSMutableArray *selectUsers;
@property (nonatomic,strong)NSMutableArray *selectProducts;
@end
......@@ -105,6 +107,8 @@ typedef enum : NSUInteger {
_dataArr = [NSMutableArray array];
self.users = [NSMutableArray array];
self.selectUsers = [NSMutableArray array];
self.selectProducts = [NSMutableArray array];
[_dataArr addObject:@"标题"];
[_dataArr addObject:@"商品"];
[_dataArr addObject:@"开始日期"];
......@@ -152,8 +156,9 @@ typedef enum : NSUInteger {
case CommitTag:
{
if ([self checkSurvey]) {
_clickState = @"submitted";
[self saveSurvey:@"submitted" message:@"正在提交..."];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认提交" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
[alertView show];
}
}
break;
......@@ -340,6 +345,7 @@ typedef enum : NSUInteger {
SurveyUser *surveyUser = [[SurveyUser alloc]init];
[surveyUser setValuesForKeysWithDictionary:userDict];
[self.selectUsers addObject:surveyUser.userUuid];
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",surveyUser.userName];
}else{
......@@ -349,7 +355,7 @@ typedef enum : NSUInteger {
_personLabel.text = personStr;
_personLabel.textColor = GXF_CONTENT_COLOR;
}
if (self.users > 0) {
if (self.users) {
[self.users addObjectsFromArray:self.survey.users];
}
}
......@@ -367,6 +373,7 @@ typedef enum : NSUInteger {
self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
self.productNameStr = [IBTCommon checkString:self.survey.productName];
self.productUuidStr = [IBTCommon checkString:self.survey.productUuid];
[self.selectProducts addObject:self.productUuidStr];
}
if (self.survey) {
......@@ -394,18 +401,25 @@ typedef enum : NSUInteger {
[self startDatePickView];
}else if(indexPath.row == 4){
ChosePersonViewController *cvc = [ChosePersonViewController new];
if (self.selectUsers.count > 0) {
cvc.selectArr = self.selectUsers;
}
cvc.choseBaseInfo = ^(NSArray *users){
if(users.count > 0){
NSString *textStr = @"";
if (self.users.count > 0) {
[self.users removeAllObjects];
}
if (self.selectUsers.count > 0) {
[self.selectUsers removeAllObjects];
}
for (SurveyUser *user in users) {
if (textStr.length == 0) {
textStr = [textStr stringByAppendingFormat:@"%@",user.userName];
}else {
textStr = [textStr stringByAppendingFormat:@"、%@",user.userName];
}
[self.selectUsers addObject:user.userUuid];
[self.users addObject:[user dictForCommit]];
}
_personLabel.text = textStr;
......@@ -416,14 +430,20 @@ typedef enum : NSUInteger {
[self PushViewController:cvc animated:YES];
}else if(indexPath.row == 1){
ChooseProductViewController *cvc = [ChooseProductViewController new];
if (self.selectProducts.count > 0) {
cvc.selectArr = self.selectProducts ;
}
cvc.choseBaseInfo = ^(NSArray *products){
if (self.selectProducts.count > 0) {
[self.selectProducts removeAllObjects];
}
Product *product = products[0];
_productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_productLabel.textColor = GXF_CONTENT_COLOR;
self.productNameStr = product.name;
self.productUuidStr = product.uuid;
self.productCodeStr = product.code;
[self.selectProducts addObject:product.uuid];
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
......@@ -492,6 +512,13 @@ typedef enum : NSUInteger {
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
_clickState = @"submitted";
[self saveSurvey:@"submitted" message:@"正在提交..."];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -73,6 +73,9 @@
NSDictionary *resultDict = surveyDict[@"result"];
SurveyResult *surveyResult = [[SurveyResult alloc]init];
[surveyResult setValuesForKeysWithDictionary:resultDict];
// for (NSS in <#collection#>) {
// <#statements#>
// }
[_dataArr addObject:surveyResult];
}
[_tableView reloadData];
......
......@@ -22,7 +22,7 @@ typedef enum : NSUInteger {
EndTag,
} BtnTag;
@interface SurveyDetailViewController ()
@interface SurveyDetailViewController ()<UIAlertViewDelegate>
{
UIScrollView *_scrollView;
UIView *_surveyView;
......@@ -133,7 +133,7 @@ typedef enum : NSUInteger {
self.beginDateLabel.text = [IBTCommon checkString:self.survey.beginDate];
self.endDateLabel.text = [IBTCommon checkString:self.survey.endDate];
self.userLabel.text = [IBTCommon checkString:user];
self.noteLabel.text = [IBTCommon checkString:self.survey.remark];
self.noteLabel.text = [NSString stringWithFormat:@"%@",self.survey.remark?self.survey.remark : @"无"];
[self setNoteHeight];
}
......@@ -230,7 +230,9 @@ typedef enum : NSUInteger {
rvc.surveyUuid = self.surveyUuid;
[self PushViewController:rvc animated:YES];
}else if (btn.tag == EndTag){
[self finishSurveyRequest];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认结束" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
[alertView show];
}
}
......@@ -295,6 +297,11 @@ typedef enum : NSUInteger {
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
[self finishSurveyRequest];//结束
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -251,7 +251,6 @@ typedef enum : NSUInteger {
#pragma mark - 确定
- (void)sureClick{
if (self.state.length > 0 || self.billNumberLike.length > 0 || self.titleLike.length > 0 ||self.orderDirection.length > 0) {
[_boltView.titleFiled resignFirstResponder];
[_boltView.billFiled resignFirstResponder];
_currentPage = 0;
......@@ -265,7 +264,6 @@ typedef enum : NSUInteger {
if (_boltView) {
[self hiddenBoltMaskView:YES];
}
}
}
#pragma mark -按钮事件
......@@ -375,6 +373,7 @@ typedef enum : NSUInteger {
CLog(@"%@",state);
}
- (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike;
CLog(@"%@",titleLike);
}
......
......@@ -24,7 +24,7 @@ typedef enum : NSUInteger {
#define BottomHeight 300
#define SpaceHeight 20
#define BottomViewHeight 60
@interface NewTransportViewController ()<TopTransportViewDelegate,UIScrollViewDelegate>
@interface NewTransportViewController ()<TopTransportViewDelegate,UIScrollViewDelegate,UIAlertViewDelegate>
{
UIScrollView *_scrollView;
TopTransportView *_sheetView;
......@@ -135,8 +135,9 @@ typedef enum : NSUInteger {
break;
case CommitTag:{
if ([self checkTransport]) {
[self getDataFromServer:TRANSPORT_STATE_UNRECEIVED msg:@"正在提交..."];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认提交" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
[alertView show];
}
}
break;
......@@ -298,7 +299,7 @@ typedef enum : NSUInteger {
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
if (billProduct) {
svc.title = @"编辑商品";
svc.navTitle = @"编辑商品";
ShopDetail *shopDetail=[self coverShopDetail:billProduct];
shopDetail.IsXiuGai=YES;
svc.choseShopDetail = ^(ShopDetail *Detail){
......@@ -311,7 +312,7 @@ typedef enum : NSUInteger {
};
svc.shopDetail=shopDetail;
}else{
svc.title = @"添加商品";
svc.navTitle = @"添加商品";
// 回调
svc.choseShopDetail = ^(ShopDetail *shopDetail){
TransportPdtDetail *tdetail = [self coverTransportPdtDetail:shopDetail];
......@@ -358,7 +359,12 @@ typedef enum : NSUInteger {
return shopDetail;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
//提交
[self getDataFromServer:TRANSPORT_STATE_UNRECEIVED msg:@"正在提交..."];
}
}
#pragma mark - TopPurchaseViewDelegate
......
......@@ -101,7 +101,7 @@ typedef enum : NSUInteger {
self.rwarehouseLabel.text = [IBTCommon checkString:self.transport.rwarehouseName];
self.carnumberLabel.text = [IBTCommon checkString:self.transport.carnumber];
self.carhoneLabel.text = [IBTCommon checkString:self.transport.carphone];
self.noteLabel.text = [IBTCommon checkString:self.transport.note];
self.noteLabel.text = [NSString stringWithFormat:@"%@",self.transport.note?self.transport.note:@"无"];
self.createOperLabel.text = [NSString stringWithFormat:@"%@%@",[IBTCommon checkString:self.transport.create_operName],self.transport.create_time.length > 10 ? [self.transport.create_time substringToIndex:10] : self.transport.create_time];
[_transView refreshTranProduct:self.transport.pdtDetails];
[_transView refreshCost:self.transport.accountDetails];
......@@ -153,13 +153,19 @@ typedef enum : NSUInteger {
case AbortTag:
{
CLog(@"作废");
[self dealByAction:TRANSPORT_STATE_ABORTED];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认作废" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
alertView.tag = AbortTag;
[alertView show];
}
break;
case EndTag:
{
CLog(@"结束");
[self dealByAction:TRANSPORT_STATE_RECEIVED];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认结束" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alertView.delegate = self;
alertView.tag = EndTag;
[alertView show];
}
break;
......@@ -272,7 +278,17 @@ typedef enum : NSUInteger {
[_bottomView addSubview:_transView];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (alertView.tag == AbortTag) {
if (buttonIndex == 1) {
[self dealByAction:TRANSPORT_STATE_ABORTED];//作废
}
}else if (alertView.tag == EndTag){
if (buttonIndex == 1) {
[self dealByAction:TRANSPORT_STATE_RECEIVED];//结束
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -11,14 +11,19 @@
#import "HeaderCell.h"
#import "TransportPurductCell.h"
#import "TransportPdtDetail.h"
#import "GXFPopView.h"
#define TableHeight 44
#define ShowHeight 110
@interface TransportProductViewController ()
<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,HeaderCellDelegate,GXFPopViewDelegate>
{
CGRect _tableFrame;
NSMutableArray *_selectRowArr;//记录当前选中的cell
}
@property (nonatomic,strong)GXFPopView *popView;
@end
@implementation TransportProductViewController
......@@ -48,8 +53,9 @@
NSArray *arr = @[@"商品",@"单价",@"包装数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:self.isHiddenEdit];
[self.view addSubview:headCell];
headCell.delegate = self;
self.tableView.tableHeaderView = headCell;
if (!self.isHiddenEdit) {
......@@ -59,6 +65,35 @@
self.tableView.tableFooterView = footCell;
}
}
#pragma mark - headCellDelegate
- (void)addClickList{
if (!self.popView) {
NSArray *arr = @[@"添加商品明细",@"选择采购单"];
self.popView = [[GXFPopView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height) withArr:arr];
self.popView.delegate = self;
[AppWindow addSubview:self.popView];
}
}
#pragma mark - popViewdelegate
- (void)selectRowTitle:(NSString *)str{
if (self.popView) {
[self.popView removeFromSuperview];
self.popView= nil;
}
if ([str isEqualToString:@"添加商品明细"]) {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil];
}else if([str isEqualToString:@"选择采购单"]){
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_ChoseTransportPurchase object:nil];
}
}
- (void)clearFromSuper{
if (self.popView) {
[self.popView removeFromSuperview];
self.popView = nil;
}
}
#pragma mark - footerDelegate
- (void)addClick{
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil];
......
......@@ -221,7 +221,9 @@
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 180;
//44+38+10 + count* 44
PurchaseBill *bill = _dataArr[indexPath.row];
return 102 + bill.products.count * 44;
}
#pragma mark - 按钮确定
- (void)sureClick{
......
......@@ -23,6 +23,9 @@
UITableView *_tableView;
NSMutableArray *_dataArr;
}
@property (nonatomic,strong)NSString *selectType;
@property (nonatomic,strong)NSString *selectRwarehouse;
@property (nonatomic,strong)NSString *selectWarehouse;
@end
......@@ -133,12 +136,14 @@
self.warehouseCode = transport.warehouseCode;
self.warehouseName = transport.warehouseName;
self.warehouseUuid = transport.warehouseUuid;
self.selectWarehouse = transport.warehouseUuid;
}
if (transport.type.length > 0) {
NSString *type = [transport.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
self.typeLabel.text = type;
self.typeLabel.textColor = GXF_CONTENT_COLOR;
self.type = transport.type;
self.selectType = transport.type;
}
if (transport.rwarehouseName.length > 0) {
self.rwarehouseLabel.text = transport.rwarehouseName;
......@@ -146,6 +151,7 @@
self.rwarehouseCode = transport.rwarehouseCode;
self.rwarehouseName = transport.rwarehouseName;
self.rwarehouseUuid = transport.rwarehouseUuid;
self.selectRwarehouse = transport.rwarehouseUuid;
}
if (transport.carnumber.length > 0) {
self.carTextFiled.text = transport.carnumber;
......@@ -165,6 +171,9 @@
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 0){
ChooseWarehouseViewController *cvc = [ChooseWarehouseViewController new];
if (self.selectWarehouse.length > 0) {
cvc.selectStr = self.selectWarehouse;
}
cvc.choseBaseInfo = ^(NSArray *warehouses){
if (warehouses.count > 0) {
Warehouse *warehouse = warehouses[0];
......@@ -173,6 +182,7 @@
self.warehouseUuid = warehouse.uuid;
self.warehouseCode = warehouse.code;
self.warehouseName = warehouse.name;
self.selectWarehouse = warehouse.uuid;
}
};
......@@ -180,6 +190,9 @@
[self.delegate pushNextViewController:cvc];
}else if(indexPath.row == 1){
ChooseWarehouseViewController *tvc = [[ChooseWarehouseViewController alloc]init];
if (self.selectRwarehouse.length > 0) {
tvc.selectStr = self.selectRwarehouse;
}
tvc.choseBaseInfo = ^(NSArray *warehouses){
if (warehouses.count > 0) {
Warehouse *warehouse = warehouses[0];
......@@ -188,16 +201,22 @@
self.rwarehouseUuid = warehouse.uuid;
self.rwarehouseCode = warehouse.code;
self.rwarehouseName = warehouse.name;
self.selectRwarehouse = warehouse.uuid;
}
};
[self.delegate pushNextViewController:tvc];
}else if(indexPath.row == 2){
ChooseTypeViewController *tvc = [[ChooseTypeViewController alloc]init];
if (self.selectType.length > 0) {
tvc.selectStr = self.selectType;
}
tvc.choseBaseInfo = ^(NSArray *types){
if (types.count > 0) {
NSString *type = types[0];
self.typeLabel.text = type;
self.selectType = type;
self.typeLabel.textColor = GXF_CONTENT_COLOR;
if ([type isEqualToString:@"紧急"]) {
self.type = GXF_Critical;
......
......@@ -251,13 +251,13 @@
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.userFiled) {
if (self.userFiled.text.length > 0) {
// if (self.userFiled.text.length > 0) {
[self.delegate getuserLike:self.userFiled.text];
}
// }
}else if(textField == self.billFiled){
if (self.billFiled.text.length > 0) {
// if (self.billFiled.text.length > 0) {
[self.delegate getbillLike:self.billFiled.text];
}
// }
}
}
......
......@@ -10,6 +10,7 @@
#import "PurchaseBill.h"
@interface TransportPurchaseCell : UITableViewCell<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UILabel *secondLabel;
......
......@@ -29,14 +29,15 @@
{
self.contentView.backgroundColor = XXFBgColor;
UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 170)];
bgView.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:bgView];
self.bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 170)];
self.bgView.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:self.bgView];
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0,0, ScreenSize.width, 1))];;
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0, 0, ScreenSize.width, 44))];
self.titleLabel.textColor = GXF_NAVIGAYION_COLOR;
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.font = GXF_SEVENTEENTH_SIZE;
......@@ -44,28 +45,43 @@
self.secondLabel.backgroundColor = GXF_LINE_COLOR;
[bgView addSubview:self.titleLabel];
[bgView addSubview:self.lineLabel];
[bgView addSubview:self.secondLabel];
[self.bgView addSubview:self.titleLabel];
[self.bgView addSubview:self.lineLabel];
[self.bgView addSubview:self.secondLabel];
}
- (void)setPurchaseBill:(PurchaseBill *)bill selectArr:(NSMutableArray *)selectArr{
self.titleLabel.text = [NSString stringWithFormat:@"采购单:%@",bill.billNumber];
self.secondArr = [NSMutableArray array];
self.selectArr = selectArr;
[self.secondArr addObjectsFromArray:bill.products];
self.secondTable = [[UITableView alloc]initWithFrame:(CGRectMake(0, 44,ScreenSize.width, 170-45)) style:(UITableViewStylePlain)];
self.secondTable = [[UITableView alloc]initWithFrame:(CGRectMake(0, 44,ScreenSize.width, self.bgView.height-45)) style:(UITableViewStylePlain)];
self.secondTable.delegate = self;
self.secondTable.dataSource = self;
self.secondTable.bounces = NO;
self.secondTable.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.contentView addSubview:self.secondTable];
[self.bgView addSubview:self.secondTable];
NSArray *arr = @[@"商品",@"单价",@"包装数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:YES];
self.secondTable.tableHeaderView = headCell;
}
- (void)setPurchaseBill:(PurchaseBill *)bill selectArr:(NSMutableArray *)selectArr{
self.bgView.height = 92 + bill.products.count * 44;
self.secondTable.height = self.bgView.height - 45;
self.titleLabel.text = [NSString stringWithFormat:@"采购单:%@",bill.billNumber];
self.secondArr = [NSMutableArray array];
self.selectArr = selectArr;
[self.secondArr addObjectsFromArray:bill.products];
// self.secondTable = [[UITableView alloc]initWithFrame:(CGRectMake(0, 44,ScreenSize.width, self.bgView.height-45)) style:(UITableViewStylePlain)];
//
// self.secondTable.delegate = self;
// self.secondTable.dataSource = self;
//// self.secondTable.bounces = NO;
// self.secondTable.separatorStyle = UITableViewCellSeparatorStyleNone;
// [self.bgView addSubview:self.secondTable];
// NSArray *arr = @[@"商品",@"单价",@"包装数量"];
//
// HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
// self.secondTable.tableHeaderView = headCell;
//重要
[self.secondTable reloadData];
}
......@@ -87,20 +103,23 @@
cell.editBtn.hidden = YES;
cell.rightImageName = @"edit";
}
if (self.secondArr.count > 0) {
TransportPdtDetail * billProduct = self.secondArr[indexPath.row];
[cell setPdtDetail:billProduct row:indexPath.row];
if ([self isHaveIndexPath:billProduct]) {
cell.editBtn.hidden = NO;
// cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
// cell.lineLabel.y = ShowHeight + TableHeight -1;
// cell.showView.height = ShowHeight;
// cell.backgroundColor = XXFBgColor;
// cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
// cell.lineLabel.y = ShowHeight + TableHeight -1;
// cell.showView.height = ShowHeight;
// cell.backgroundColor = XXFBgColor;
}else{
cell.editBtn.hidden = YES;
// cell.smallImageView.image = [UIImage imageNamed:@"arrowright"];
// cell.lineLabel.y = TableHeight -1;
// cell.showView.height = 0;
// cell.backgroundColor = [UIColor whiteColor];
// cell.smallImageView.image = [UIImage imageNamed:@"arrowright"];
// cell.lineLabel.y = TableHeight -1;
// cell.showView.height = 0;
// cell.backgroundColor = [UIColor whiteColor];
}
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
......@@ -140,7 +159,7 @@
}
- (BOOL)isHaveIndexPath:(TransportPdtDetail *)billProduct{
for (TransportPdtDetail *detail in self.selectArr) {
if (detail.uuid == billProduct.uuid) {
if (detail.uuid == billProduct.uuid || [detail.uuid isEqualToString:billProduct.uuid]) {
return YES;
}
}
......
......@@ -152,7 +152,7 @@
self.showPurchaseLabel.text = [NSString stringWithFormat:@"采购单号:%@",pdtDetail.purchasebillnumber.length > 0 ? pdtDetail.purchasebillnumber: @"无"];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",pdtDetail.total];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note ? pdtDetail.note :@"无"];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
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