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

采购通知单

parent 9e53ce25
......@@ -145,6 +145,10 @@
72C803521B7B897B00990363 /* DataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 72C803511B7B897B00990363 /* DataManager.m */; };
72EDD86E1B96E11700964115 /* ChooseParentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EDD86D1B96E11700964115 /* ChooseParentViewController.m */; };
72F56CB21B76EC200077F0C9 /* SurveyUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F56CB11B76EC200077F0C9 /* SurveyUser.m */; };
72F9D47F1BA7E97200795A00 /* NoticeProduct.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D47E1BA7E97200795A00 /* NoticeProduct.m */; };
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 */; };
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 */; };
......@@ -685,6 +689,14 @@
72EDD86D1B96E11700964115 /* ChooseParentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseParentViewController.m; sourceTree = "<group>"; };
72F56CB01B76EC200077F0C9 /* SurveyUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurveyUser.h; sourceTree = "<group>"; };
72F56CB11B76EC200077F0C9 /* SurveyUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyUser.m; sourceTree = "<group>"; };
72F9D47D1BA7E97200795A00 /* NoticeProduct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoticeProduct.h; sourceTree = "<group>"; };
72F9D47E1BA7E97200795A00 /* NoticeProduct.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoticeProduct.m; sourceTree = "<group>"; };
72F9D4801BA7EC9600795A00 /* NoticeProductViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoticeProductViewController.h; sourceTree = "<group>"; };
72F9D4811BA7EC9600795A00 /* NoticeProductViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoticeProductViewController.m; sourceTree = "<group>"; };
72F9D4831BA7FFC400795A00 /* PurchaseNotice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseNotice.h; sourceTree = "<group>"; };
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>"; };
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>"; };
......@@ -1062,6 +1074,10 @@
04B4A3861B9CAAD700D88D68 /* ShopDetail.m */,
04E721E11BA755FD008F9158 /* ProductUnit.h */,
04E721E21BA755FD008F9158 /* ProductUnit.m */,
72F9D47D1BA7E97200795A00 /* NoticeProduct.h */,
72F9D47E1BA7E97200795A00 /* NoticeProduct.m */,
72F9D4831BA7FFC400795A00 /* PurchaseNotice.h */,
72F9D4841BA7FFC400795A00 /* PurchaseNotice.m */,
);
path = Models;
sourceTree = "<group>";
......@@ -1077,6 +1093,10 @@
04E721DF1BA73CE2008F9158 /* ChooseProductUnitViewController.m */,
0414FF151B94959700C7B00E /* ShopDetaileViewController.h */,
0414FF161B94959700C7B00E /* ShopDetaileViewController.m */,
72F9D4801BA7EC9600795A00 /* NoticeProductViewController.h */,
72F9D4811BA7EC9600795A00 /* NoticeProductViewController.m */,
72F9D4861BA8065500795A00 /* PurchaseNoticeListCell.h */,
72F9D4871BA8065500795A00 /* PurchaseNoticeListCell.m */,
);
path = Views;
sourceTree = "<group>";
......@@ -2587,6 +2607,7 @@
C11A34661B24487D00079129 /* ICRAnswer.m in Sources */,
C1D017171AD8EF8100CD9CB8 /* IBTSegmentedControl.m in Sources */,
C10C90901AE54FE300B911CD /* IBTDatePickerViewController.m in Sources */,
72F9D4881BA8065500795A00 /* PurchaseNoticeListCell.m in Sources */,
0414FF1A1B94959700C7B00E /* SelectCompanyViewController.m in Sources */,
C1C5644B1AD66EB4006A1050 /* ICRTaskListViewController.m in Sources */,
35CF33981B96BB02001211EF /* GXFPaging.m in Sources */,
......@@ -2597,6 +2618,7 @@
C1FE50501AE024FA00C18080 /* UIActionSheet+Blocks.m in Sources */,
C123A92B1B26EDDA003C0C36 /* ICRQuestionHelperView.m in Sources */,
7281A0BF1B8980E60052B1AC /* PurchaseBill.m in Sources */,
72F9D4851BA7FFC400795A00 /* PurchaseNotice.m in Sources */,
0414FF191B94959700C7B00E /* PurchaseNoticeCell.m in Sources */,
7217E9EB1B72364300FE5C1D /* HPGrowingTextView.m in Sources */,
724171761B9D30DE0094DF55 /* ChooseCostViewController.m in Sources */,
......@@ -2732,6 +2754,7 @@
C10C90A11AE5751D00B911CD /* ICRPost.m in Sources */,
0414FF1B1B94959700C7B00E /* ShopDetaileViewController.m in Sources */,
7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */,
72F9D47F1BA7E97200795A00 /* NoticeProduct.m in Sources */,
C1FE50351AE020D400C18080 /* IBTAudioController.m in Sources */,
7281A0C21B898A040052B1AC /* PurchaseDetailViewController.m in Sources */,
C14BE3061ADB84350049F1AA /* IBTTextFieldCell.m in Sources */,
......@@ -2778,6 +2801,7 @@
C123A9291B26EDDA003C0C36 /* ICRQInputPopup.m in Sources */,
30D702421ADE37D3008DC0BF /* ICRAnnouncementDetailViewController.m in Sources */,
FE17F6791B85847D0078CE96 /* QueryOrder.m in Sources */,
72F9D4821BA7EC9600795A00 /* NoticeProductViewController.m in Sources */,
C15039221ADE39190081A686 /* IBTUIControl.m in Sources */,
C112BC4D1AD91CF800F75F58 /* ICRPatrolDetailViewController.m in Sources */,
0414FF181B94959700C7B00E /* SeePurchaseNoticeViewController.m in Sources */,
......
......@@ -182,15 +182,15 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_FinishProcess] = @"process/finish",
[XFFHttp_AbortProcess] = @"process/abort",
//采购通知单
[XFFHttp_savePurchaseNotice] = @"purchase/notice/save",
[XFFHttp_savePurchaseNotice] = @"purchase/notice/save",
[XFFHttp_getPurchaseNoticeList] = @"purchase/notice/query",
[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_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_getPurchaseNoticeRecod] = @"purchase/trace/get/",
[XFFHttp_getPurchaseNoticeRecod] = @"purchase/trace/get/",
//采购单
......@@ -2340,10 +2340,42 @@ acceptTypeJson:YES
}
//3·采购通知单明细(读)
- (void)getPurchaseNoticeDetailedWithPurchaseUuid:(NSString *)purchaseUuid success:(void (^)(id))succ
failure:(void (^)(id))fail
- (void)getPurchaseNoticeDetailedWithPurchaseUuid:(NSString *)purchaseUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail
{
if (!purchaseUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_getPurchaseNoticeDetailed] stringByAppendingFormat:@"/%@",purchaseUuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//4·保存并提交采购通知单
- (void)saveAndSubmitPurchaseNoticeWithData:(id)data
......
......@@ -179,6 +179,17 @@
#define TRANSPORT_STATE_RECEIVED @"received" //已收货
#define TRANSPORT_STATE_ABORTED @"aborted" //已废用
//采购通知单状态
//initial("未提交"), notAccepted("未接受"), purchasing("采购中"), finished("已完成")
#define PURCHASENOTICE_STATE_INITIAL @"initial"
#define PURCHASENOTICE_STATE_NOTACCEPTED @"notAccepted"
#define PURCHASENOTICE_STATE_PURCHASEING @"purchasing"
#define PURCHASENOTICE_STATE_FINISHED @"finished"
//采购通知单权限
#define NOTICE_PERMISSIONS_ACCEPTTASK @"500304"//接受任务
#define NOTICE_PERMISSIONS_CREATEBILL @"500305"//新建权
#define NOTICE_PERMISSIONS_FINISH @"500306"//结束
#endif
......@@ -162,6 +162,7 @@ typedef enum : NSUInteger {
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
if (billProduct) {
svc.navTitle = @"编辑商品";
ShopDetail *shopDetail=[self coverShopDetail:billProduct];
shopDetail.IsXiuGai=YES;
svc.choseShopDetail = ^(ShopDetail *Detail){
......@@ -177,6 +178,7 @@ typedef enum : NSUInteger {
svc.shopDetail=shopDetail;
}else{
// 回调
svc.navTitle = @"添加商品";
svc.choseShopDetail = ^(ShopDetail *shopDetail){
PurchaseBillProduct *billProduct = [self coverPurchaseProduct:shopDetail];
[_pvc.productArr addObject:billProduct];
......
......@@ -89,11 +89,6 @@
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}
// else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_SHIPPING]) {
// stateStr = @"发运中";
// [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
//
// }
else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_FINISHED]) {
stateStr = @"已完成";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
......
......@@ -7,7 +7,7 @@
//
#import "ICRBaseViewController.h"
#import "PurchaseNotice.h"
@interface NewPurchaseNoticeViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseNotice *purchaseNotice;
@end
......@@ -13,10 +13,9 @@
#import "SeePurchaseNoticeViewController.h"
#import "ChosePersonViewController.h"
#import "SurveyUser.h"
#import "Survey.h"
#import "PurchaseNoticeCell.h"
#import "ShopDetaileViewController.h"
#import "ShopDetail.h"
#import "NoticeProductViewController.h"
#import "NoticeProduct.h"
#import "PurchaseBillProduct.h"
#define LeftMargin 15
#define LeftWidth 40
......@@ -45,8 +44,6 @@ typedef enum : NSUInteger {
NSMutableArray *_shopeArr;
UITextField *_titleField;
UILabel *_productLabel;
UILabel *_startDateLabel;
UILabel *_endDateLabel;
UILabel *_personLabel;
HPGrowingTextView *_noteTextView;
NSIndexPath *selectedCellIndexPath;
......@@ -60,15 +57,10 @@ typedef enum : NSUInteger {
}
@property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productNameStr;
@property (nonatomic,strong)NSString *productUuidStr;
@property (nonatomic,strong)NSString *beginDateStr;
@property (nonatomic,strong)NSString *endDateStr;
@property (nonatomic,strong)NSString *purchaseCodeStr;
@property (nonatomic,strong)NSString *purchaseNameStr;
@property (nonatomic,strong)NSString *purchaseUuidStr;
@property (nonatomic,strong)NSString *remarkStr;
@property (nonatomic,strong)NSMutableArray *users;
@property (nonatomic,strong)Survey *survey;
@property (nonatomic,strong)SurveyUser *surveyUser;
@property (nonatomic,strong)UILabel *HeardLabel;
@property (nonatomic,strong)UILabel *FootLabel;
......@@ -82,13 +74,73 @@ typedef enum : NSUInteger {
- (void)viewDidLoad {
[super viewDidLoad];
[self setupSubviews];
//数据默认值
uuidObject = [NSNull null];
billNumberObject = [NSNull null];
versionObject = [NSNumber numberWithInteger:0];
[self setupSubviews];
// Do any additional setup after loading the view.
if (self.purchaseNotice) {
[self getDataFromServer];
}
}
- (void)getDataFromServer{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
NSDictionary *dictData = data[@"data"];
PurchaseNotice *purchaseNotice = [[PurchaseNotice alloc]init];
[purchaseNotice setValuesForKeysWithDictionary:dictData];
strongSelf.purchaseNotice = purchaseNotice;
[strongSelf prepareDataInCell];
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@" 无记录 "];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getPurchaseNoticeDetailedWithPurchaseUuid:self.purchaseNotice.uuid success:succ failure:fail];
}
- (void)prepareDataInCell{
if (self.purchaseNotice) {
if (self.purchaseNotice.title.length > 0) {
_titleField.text = self.purchaseNotice.title;
self.titleStr = self.purchaseNotice.title;
}
if (self.purchaseNotice.purchaserName.length > 0) {
_personLabel.text = self.purchaseNotice.purchaserName;
_personLabel.textColor = GXF_CONTENT_COLOR;
self.purchaseUuidStr = self.purchaseNotice.purchaserUuid;
self.purchaseCodeStr = self.purchaseNotice.purchaserCode;
self.purchaseNameStr = self.purchaseNotice.purchaserName;
}
if (self.purchaseNotice.remark) {
_noteTextView.text = self.purchaseNotice.remark;
self.remarkStr = self.purchaseNotice.remark;
}
}
NSMutableArray *arr = [NSMutableArray array];
for (NSDictionary *productDict in self.purchaseNotice.products) {
NoticeProduct *billProduct = [[NoticeProduct alloc]init];
[billProduct setValuesForKeysWithDictionary:productDict];
[arr addObject:billProduct];
}
_shopeArr = arr;
[mingXiTableView reloadData];
}
-(void)setupSubviews
{
selectCellAry=[[NSMutableArray alloc]initWithCapacity:1000];
......@@ -132,9 +184,9 @@ typedef enum : NSUInteger {
}
// UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i,0, headWidth, 50)];
lable.text=[ary objectAtIndex:i];
lable.textColor=GXF_CONTENT_COLOR;
lable.textColor=GXF_PLACEHOLDER_COLOR;
lable.font = GXF_FIFTEENTEN_SIZE;
[footView2 addSubview:lable];
}
UIView *footView3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
......@@ -142,8 +194,9 @@ typedef enum : NSUInteger {
self.addDetailedButton=[UIButton buttonWithType: UIButtonTypeCustom];
[self.addDetailedButton setFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
[self.addDetailedButton setTitle:@"+ 点击添加商品明细" forState:UIControlStateNormal];
self.addDetailedButton.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[self.addDetailedButton addTarget:self action:@selector(addShopeDetailed) forControlEvents:UIControlEventTouchUpInside];
[self.addDetailedButton setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
[self.addDetailedButton setTitleColor:GXF_PLACEHOLDER_COLOR forState:UIControlStateNormal];
self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, footView3.size.height-1, footView3.size.width-2*LeftMargin, 1))];
self.FootLabel.backgroundColor = HexColor(@"e5e5e5");
self.FootLabel.font = FontSize(TitleSize);
......@@ -254,8 +307,6 @@ typedef enum : NSUInteger {
}else if ([tableView isEqual:mingXiTableView])
{
if ([self comperIndexpath:indexPath]) {
return TableHeight*3;
}else
......@@ -272,22 +323,15 @@ typedef enum : NSUInteger {
if(indexPath.row == 1){
ChosePersonViewController *cvc = [ChosePersonViewController new];
cvc.choseBaseInfo = ^(NSArray *users){
NSString *textStr = @"";
if (self.users.count <=0) {
[self.users removeAllObjects];
}
for (SurveyUser *user in users) {
if (textStr.length == 0) {
textStr = [textStr stringByAppendingFormat:@"%@",user.userName];
}else {
textStr = [textStr stringByAppendingFormat:@"、%@",user.userName];
}
self.surveyUser=user;
[self.users addObject:[user dictForCommit]];
if (users.count > 0) {
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;
}
_personLabel.text = textStr;
_personLabel.textColor = GXF_CONTENT_COLOR;
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
......@@ -346,7 +390,6 @@ typedef enum : NSUInteger {
if (indexPath.row == 1) {
contentLabel.text = @"选择采购员";
_personLabel = contentLabel;
[self preferDataInPersonLabel];
}
}
}
......@@ -359,83 +402,61 @@ typedef enum : NSUInteger {
}
return NO;
}
- (void)preferDataInPersonLabel{
if (self.survey) {
if (self.survey.users.count > 0) {
NSString *personStr = @"";
for (SurveyUser * surveyUser in self.survey.users) {
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",surveyUser.userName];
}else {
personStr = [personStr stringByAppendingFormat:@"、%@",surveyUser.userName];
}
}
_personLabel.text = personStr;
_personLabel.textColor = GXF_CONTENT_COLOR;
}
if (self.users > 0) {
[self.users addObjectsFromArray:self.survey.users];
}
}
}
//添加商品明细
-(void)addShopeDetailed
{
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
// 回调
svc.choseShopDetail = ^(ShopDetail *shopDetail){
[_shopeArr addObject:shopDetail];
[mingXiTableView reloadData];
NoticeProductViewController *nvc = [NoticeProductViewController new];
nvc.navTitle = @"添加商品";
nvc.choseNoticeProduct = ^(NoticeProduct *product,NSIndexPath *indexPath){
if (product) {
[_shopeArr addObject:product];
[mingXiTableView reloadData];
}
};
svc.title = [IBTCommon localizableString:@"AddShopDetail"];
[self PushViewController:svc animated:YES];
[self PushViewController:nvc animated:YES];
}
-(void)showShopDetail:(PurchaseNoticeCell*)Cell indexPath:(NSIndexPath *)indexPath
{
ShopDetail *shopDetail=[_shopeArr objectAtIndex:indexPath.row];
Cell.SpLabel.text=shopDetail.merchandise;//商品
Cell.DjLabel.text=shopDetail.packageUnitPrice;//包装单价
Cell.BzggLabel.text=shopDetail.packageSpecification;//包装规格
Cell.BzslLabel.text=shopDetail.packageQuantity;//包装数量
Cell.packageSpecification.text=shopDetail.packageSpecification;//包装规格
Cell.foundationQuantity.text=shopDetail.foundationQuantity;//基础数量
Cell.packageUnitPrice.text=shopDetail.packageUnitPrice;//包装单价
Cell.remark.text=shopDetail.remark;//备注
Cell.packageQuantity.text=shopDetail.packageQuantity;//包装数量
Cell.foundationUnitPrice.text=shopDetail.foundationUnitPrice;//基础单价
Cell.totalMoney.text=shopDetail.totalMoney;//总金额
NoticeProduct *noticeProduct=[_shopeArr objectAtIndex:indexPath.row];
Cell.SpLabel.text=noticeProduct.productName;//商品
Cell.DjLabel.text=noticeProduct.packUnit;//包装单价
Cell.BzggLabel.text=[noticeProduct.qpc stringValue];//包装规格
Cell.BzslLabel.text=[noticeProduct.qpcQuantity stringValue];//包装数量
Cell.packageSpecification.text=[noticeProduct.qpc stringValue];//包装规格
Cell.foundationQuantity.text=[noticeProduct.quantity stringValue];//基础数量
Cell.remark.text=noticeProduct.remark;//备注
}
//编辑
- (void)didtoucher:(UIButton*)button
{
ShopDetail *shopDetail=[_shopeArr objectAtIndex:button.tag];
shopDetail.IsXiuGai=YES;
// EditorShopDetail
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
svc.choseShopDetail = ^(ShopDetail *Detail){
if (Detail.IsDeleted) {
[_shopeArr removeObjectAtIndex:button.tag];
}else{
[_shopeArr replaceObjectAtIndex:button.tag withObject:Detail];
NoticeProductViewController *nvc = [NoticeProductViewController new];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:button.tag];
NoticeProduct *shopDetail=[_shopeArr objectAtIndex:button.tag];
if (indexPath) {
nvc.navTitle = @"编辑费用";
nvc.indexPath = indexPath;
nvc.noticeProduct = shopDetail;
}
nvc.choseNoticeProduct = ^(NoticeProduct *fee,NSIndexPath *indexPath){
if (fee) {
[_shopeArr replaceObjectAtIndex:indexPath.row withObject:fee];
[mingXiTableView reloadData];
}
[mingXiTableView reloadData];
// NSIndexPath *indexPath_1=[NSIndexPath indexPathForRow:button.tag inSection:0];
// NSArray *indexArray=[NSArray arrayWithObject:indexPath_1];
// [mingXiTableView reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationLeft];
};
svc.shopDetail=shopDetail;
svc.title = [IBTCommon localizableString:@"EditorShopDetail"];
[self PushViewController:svc animated:YES];
//
NSLog(@"123213232332323223");
nvc.deleteNoticeProduct = ^(NoticeProduct *fee,NSIndexPath *indexPath){
if (fee) {
[_shopeArr removeObjectAtIndex:indexPath.row];
[mingXiTableView reloadData];
}
};
[self PushViewController:nvc animated:YES];
}
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
......@@ -451,14 +472,14 @@ typedef enum : NSUInteger {
case SaveTag:
{
if ([self checkSurvey]) {
[self saveSurvey:@"initial" message:@"正在保存..."];
[self saveSurvey:PURCHASENOTICE_STATE_INITIAL message:@"正在保存..."];
}
}
break;
case CommitTag:
{
if ([self checkSurvey]) {
[self saveSurvey:@"submitted" message:@"正在提交..."];
[self saveSurvey:PURCHASENOTICE_STATE_NOTACCEPTED message:@"正在提交..."];
}
}
break;
......@@ -482,27 +503,6 @@ typedef enum : NSUInteger {
return NO;
}
// if (self.productUuidStr.length == 0 || self.productNameStr.length == 0|| self.productCodeStr.length == 0 ) {
// ShowMessage(@"调研商品不能为空");
// return NO;
// }
// if (self.beginDateStr.length == 0) {
// ShowMessage(@"调研开始日期不能为空");
// return NO;
// }
// if (self.endDateStr.length == 0) {
// ShowMessage(@"调研结束日期不能为空");
// return NO;
// }
// if (self.users.count <=0) {
// ShowMessage(@"调研人员不能为空");
// return NO;
// }
// if ([IBTCommon compareDate:self.beginDateStr withDate:self.endDateStr] < 0) {
// ShowMessage(@"开始日期不能小于结束日期");
// return NO;
// }
//
return YES;
}
- (void)saveSurvey:(NSString *)state message:(NSString *)msg
......@@ -516,13 +516,13 @@ typedef enum : NSUInteger {
if (success == 1) {
//成功
if ([state isEqualToString:@"initial"]) {//保存成功
// NSString *uuidS = data[@"data"][@"uuid"];
// NSString *billNumberS = data[@"data"][@"billNumber"];
// NSNumber *versionN = data[@"data"][@"version"];
//// uuidObject = uuidS;
//// billNumberObject = billNumberS;
//// versionObject = versionN;
// [IBTLoadingView showTips:[NSString stringWithFormat:@"当前单据%@已保存成功",billNumberS]];
NSString *uuidS = data[@"data"][@"uuid"];
NSString *billNumberS = data[@"data"][@"billNumber"];
NSNumber *versionN = data[@"data"][@"version"];
uuidObject = uuidS;
billNumberObject = billNumberS;
versionObject = versionN;
[IBTLoadingView showTips:[NSString stringWithFormat:@"当前单据%@已保存成功",billNumberS]];
}else{//提交成功
PurchaseNoticeViewController *svc = [PurchaseNoticeViewController new];
[self PushViewController:svc animated:YES];
......@@ -537,33 +537,31 @@ typedef enum : NSUInteger {
[IBTLoadingView showTips:data];
};
// if(self.survey.uuid.length > 0 && uuidObject == [NSNull null]){
// uuidObject = self.survey.uuid;
// }
// if (self.survey.billNumber > 0 && billNumberObject == [NSNull null]) {
// billNumberObject = self.survey.billNumber;
// }
// if (self.survey && [versionObject integerValue] == 0) {
// versionObject = self.survey.version;
// }
if(self.purchaseNotice.uuid.length > 0 && uuidObject == [NSNull null]){
uuidObject = self.purchaseNotice.uuid;
}
if (self.purchaseNotice.billnumber > 0 && billNumberObject == [NSNull null]) {
billNumberObject = self.purchaseNotice.billnumber;
}
if (self.purchaseNotice && [versionObject integerValue] == 0) {
versionObject = self.purchaseNotice.version;
}
NSMutableArray *billProducts = [NSMutableArray array];
for (ShopDetail *billProduct in _shopeArr) {
[billProducts addObject:[billProduct dictForCommit]];
for (NoticeProduct *product in _shopeArr) {
[billProducts addObject:[product dictForCommit]];
}
NSDictionary *dict = @{@"uuid":uuidObject,//唯一标识
@"billnumber":billNumberObject,
@"version":versionObject,
@"title":title,
@"title":self.titleStr,
@"state":state,
@"purchaserUuid":self.surveyUser.userUuid,
@"purchaserCode":self.surveyUser.userCode,
@"purchaserName":self.surveyUser.userName,
@"remark":_noteTextView.text,
@"products":billProducts}; [IBTLoadingView showProgressLabel:msg];
@"purchaserUuid":self.purchaseUuidStr,
@"purchaserCode":self.purchaseCodeStr,
@"purchaserName":self.purchaseNameStr,
@"remark":self.remarkStr,
@"products":billProducts};
[IBTLoadingView showProgressLabel:msg];
[[ICRHTTPController sharedController] savePurchaseNoticeWithData:dict success:succ failure:fail];
}
......
......@@ -7,14 +7,14 @@
//
#import "PurchaseNoticeViewController.h"
#import "PurchaseCell.h"
#import "PurchaseBill.h"
#import "SeePurchaseNoticeViewController.h"
#import "NewPurchaseNoticeViewController.h"
#import "QueryOrder.h"
#import "SortMaskView.h"
#import "PurchaseBoltView.h"
#import "MJRefresh.h"
#import "PurchaseNoticeListCell.h"
#import "PurchaseNotice.h"
#define TopMargin 44
#define TableHeight 120
#define LeftMargin 20
......@@ -56,39 +56,12 @@ typedef enum : NSUInteger {
[self createTableView];
[self createRefresh];
[self getData];
// Do any additional setup after loading the view.
[self createBackBtn];
}
- (void)initData{
self.view.backgroundColor = XXFBgColor;
self.dataArr = [NSMutableArray array];
for (NSInteger i = 0; i < 6; i++) {
PurchaseBill *bill = [PurchaseBill new];
bill.billNumber = @"222222222";
bill.noticeNumber = @"134594059654";
bill.create_operName = @"创建人";
bill.create_time = @"2013-03-04";
bill.vendor_name = @"供应商";
bill.total = [NSNumber numberWithFloat:22];
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];
}
}
- (void)getData{
[ICRUserUtil sharedInstance].needFresh = NO;
......@@ -149,31 +122,16 @@ typedef enum : NSUInteger {
[orderArr addObject:[order dictForCommit]];
}
// 网络请求
NSDictionary *dict = @{
@"billNumberLike":billObject,
@"state":stateObject,
@"noticeNumberLike":noticeObject,
@"titleLike":[NSNull null],
@"vendorUuid":[NSNull null],
@"queryOrders":orderArr,
@"userUuid":userUtil.userId,
@"title":[NSNull null],
@"orderField":@"created",
@"orderDirection":@"desc",
// @"queryOrders":orderArr,
@"pageNumber":@(_currentPage),
@"pageSize":@(20)};
[[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail];
// NSDictionary *dict = @{
// @"billNumberLike":billObject,
// @"state":stateObject,
// @"noticeNumberLike":noticeObject,
// @"titleLike":[NSNull null],
//// @"orderField":@"created",
//// @"orderDirection":@"desc",
// @"vendorUuid":[NSNull null],
// @"queryOrders":orderArr,
// @"userUuid":userUtil.userId,
// @"pageNumber":@(_currentPage),
// @"pageSize":@(20)};
// [[ICRHTTPController sharedController] queryPurchaseWithData:dict success:succ failure:fail];
[[ICRHTTPController sharedController] getPurchaseNoticeListWithData:dict success:succ failure:fail];
}
//刷新列表
- (void)fetchtPuchaseList:(id)data{
......@@ -182,13 +140,13 @@ typedef enum : NSUInteger {
NSString *message = data[@"message"] ;
if (success == 1) {
if (_currentPage == 0) {
// if (self.dataArr.count > 0) {
// [self.dataArr removeAllObjects];
// }
if (self.dataArr.count > 0) {
[self.dataArr removeAllObjects];
}
}
NSArray *recodesArr = data[ @"data" ][ @"records" ];
for (NSDictionary *purchaseBillDict in recodesArr) {
PurchaseBill *purchaseBill = [[PurchaseBill alloc]init];
PurchaseNotice *purchaseBill = [[PurchaseNotice alloc]init];
[purchaseBill setValuesForKeysWithDictionary:purchaseBillDict];
[self.dataArr addObject:purchaseBill];
}
......@@ -440,38 +398,52 @@ typedef enum : NSUInteger {
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"SurveyID";
PurchaseCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
static NSString *cellID = @"PurchaseNoticeListCell";
PurchaseNoticeListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[PurchaseCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell = [[PurchaseNoticeListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (self.dataArr.count > 0) {
PurchaseBill *bill = self.dataArr[indexPath.row];
[cell setPurchaseBill:bill];
PurchaseNotice *bill = self.dataArr[indexPath.row];
cell.purchaseNotice = bill;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
SeePurchaseNoticeViewController *pvc = [SeePurchaseNoticeViewController new];
pvc.title = @"查看采购单";
pvc.bill = _dataArr[indexPath.row];
if(indexPath.row == 0){
pvc.indexPerson = 0;
}else if(indexPath.row == 1){
pvc.indexPerson = 1;
}else if(indexPath.row == 2){
pvc.indexPerson = 2;
if (_dataArr.count > 0) {
PurchaseNotice *purchaseNotice = _dataArr[indexPath.row];
if ([purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_INITIAL]) {
NewPurchaseNoticeViewController *nvc = [NewPurchaseNoticeViewController new];
nvc.purchaseNotice = purchaseNotice;
nvc.title = @"修改采购单通知";
[self PushViewController:nvc animated:YES];
}else{
SeePurchaseNoticeViewController *pvc = [SeePurchaseNoticeViewController new];
pvc.title = @"查看采购单";
pvc.purchaseNotice = purchaseNotice;
[self PushViewController:pvc animated:YES];
}
}
[self PushViewController:pvc animated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)createBackBtn{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
btn.frame = CGRectMake(0, 0, 12, 20);
[btn addTarget:self action:@selector(backRV) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithCustomView:btn];
self.navigationItem.leftBarButtonItem = back;
}
- (void)backRV{
[self PopToRootViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
......
......@@ -7,10 +7,10 @@
//
#import "ICRBaseViewController.h"
#import "PurchaseBill.h"
#import "PurchaseNotice.h"
@interface SeePurchaseNoticeViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *bill;
//模拟三个人员
@property (nonatomic,strong)PurchaseNotice *purchaseNotice;
@property (nonatomic,assign)NSInteger indexPerson;//0.1.2
@end
......@@ -16,12 +16,9 @@
#define TopMargin 15
typedef enum : NSUInteger {
CancleTag = 3500,
EndTag,
RejectTag,
PassTag,
SureTag
EndTag = 3500,//结束
NewTag,//新建
AcceptTag,//接受
} BtnTag;
......@@ -37,21 +34,11 @@ typedef enum : NSUInteger {
UIButton *_rejectBtn;
}
@property (nonatomic,strong)UILabel *billNumberLabel;
@property (nonatomic,strong)UILabel *noticeNumberLabel;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *createOperNameLabel;
@property (nonatomic,strong)UILabel *checkNameLabel;
@property (nonatomic,strong)UILabel *userLabel;
@property (nonatomic,strong)UILabel *stateLabel;
@property (nonatomic,strong)UILabel *lastModifyNameLabel;
@property (nonatomic,strong)UILabel *typeLabel;
@property (nonatomic,strong)UILabel *vendorNameLabel;
@property (nonatomic,strong)UILabel *vendorIsSureLabel;
@property (nonatomic,strong)UILabel *warehouseLabel;
@property (nonatomic,strong)UILabel *otherPriceLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UILabel *noteLabel;
@end
......@@ -62,7 +49,6 @@ typedef enum : NSUInteger {
[super viewDidLoad];
[self bulidLayout];
[self getDataFromServer];
// Do any additional setup after loading the view.
}
- (void)getDataFromServer{
__weak typeof(self)weakSelf = self;
......@@ -74,10 +60,10 @@ typedef enum : NSUInteger {
NSString *message = data[@"message"] ;
if (success == 1) {
NSDictionary *dictData = data[@"data"];
PurchaseBill *bill = [[PurchaseBill alloc]init];
[bill setValuesForKeysWithDictionary:dictData];
self.bill = bill;
[strongSelf fetchtPurchaseDetail];
PurchaseNotice *purchaseNotice = [[PurchaseNotice alloc]init];
[purchaseNotice setValuesForKeysWithDictionary:dictData];
strongSelf.purchaseNotice = purchaseNotice;
[strongSelf fetchtNoticeDetail];
}else{
[IBTLoadingView showTips:message];
}
......@@ -90,7 +76,30 @@ typedef enum : NSUInteger {
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getPurchaseResultWithPurchaseUuid:@"5a7417014f926eb5014f93b18fbc000f" success:succ failure:fail];
[[ICRHTTPController sharedController] getPurchaseNoticeDetailedWithPurchaseUuid:self.purchaseNotice.uuid success:succ failure:fail];
}
- (void)fetchtNoticeDetail{
self.billNumberLabel.text = [IBTCommon checkString:self.purchaseNotice.billnumber];
if ([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_NOTACCEPTED]) {
self.stateLabel.textColor = [UIColor redColor];
self.stateLabel.text = @"未接受";
}else if ([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_PURCHASEING]) {
self.stateLabel.textColor = [UIColor greenColor];
self.stateLabel.text = @"采购中";
}else if ([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_FINISHED]) {
self.stateLabel.textColor = [UIColor grayColor];
self.stateLabel.text = @"已完成";
}
self.createOperNameLabel.text = [NSString stringWithFormat:@"%@%@",[IBTCommon checkString:self.purchaseNotice.create_operName],self.purchaseNotice.create_time.length > 10 ? [self.purchaseNotice.create_time substringToIndex:10] : self.purchaseNotice.create_time];
self.titleLabel.text = [IBTCommon checkString:self.purchaseNotice.title];
self.userLabel.text = [IBTCommon checkString:self.purchaseNotice.purchaserName];
self.countLabel.text = @"";
self.noteLabel.text = [IBTCommon checkString:self.purchaseNotice.remark];
// [_transView refreshTranProduct:self.transport.pdtDetails];
// [_transView refreshCost:self.transport.accountDetails];
[self setNoteHeight];
}
......@@ -105,71 +114,71 @@ typedef enum : NSUInteger {
[self createBtn];
[self createPurchaseView];
[self createBottomView];
if ([self.bill.state isEqualToString:@"finished"]) {
}
- (void)hiddenBottomBtn{
_endBtn.hidden = YES;
_rejectBtn.hidden = YES;
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
}
}
- (void)createBtn{
_rejectBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:RejectTag image:nil title:@"" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
_rejectBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[self.view addSubview:_rejectBtn];
_endBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(_rejectBtn.frame)+ LeftMargin, ScreenSize.height - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:_endBtn];
if (self.indexPerson == 0) {
_rejectBtn.hidden = NO;
_rejectBtn.tag = CancleTag;
[_rejectBtn setTitle:@"作废" forState:UIControlStateNormal];
_endBtn.tag = EndTag;
[_endBtn setTitle:@"结束" forState:UIControlStateNormal];
}else if(self.indexPerson == 1){
_rejectBtn.hidden = NO;
_rejectBtn.tag = RejectTag;
[_rejectBtn setTitle:@"拒绝" forState:UIControlStateNormal];
[_endBtn setTitle:@"审核通过" forState:UIControlStateNormal];
_endBtn.tag = PassTag;
}else{
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = SureTag;
[_endBtn setTitle:@"确认" forState:UIControlStateNormal];
if ([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_NOTACCEPTED]) {
if ([self checkIsPermission:NOTICE_PERMISSIONS_ACCEPTTASK]) {
_rejectBtn.tag = AcceptTag;
[_rejectBtn setTitle:@"接受任务" forState:UIControlStateNormal];
}
if ([self checkIsPermission:NOTICE_PERMISSIONS_CREATEBILL]) {
_endBtn.tag = NewTag;
[_endBtn setTitle:@"新建采购单" forState:UIControlStateNormal];
}
}else if([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_PURCHASEING]){
if([self checkIsPermission:NOTICE_PERMISSIONS_FINISH]){
_rejectBtn.hidden = YES;
_endBtn.frame = CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin * 2, 40);
_endBtn.tag = EndTag;
[_endBtn setTitle:@"结束" forState:UIControlStateNormal];
}else{
[self hiddenBottomBtn];
}
}else if([self.purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_FINISHED]) {
[self hiddenBottomBtn];
}
}
- (BOOL)checkIsPermission:(NSString *)permission{
for (NSString *per in [ICRUserUtil sharedInstance].permissions) {
if ([per isEqualToString:permission]) {
return YES;
}
}
return NO;
}
- (void)btnClick:(UIButton *)btn{
NSLog(@"%ld",(long)btn.tag);
switch (btn.tag) {
case CancleTag:
{
NSLog(@"作废");
}
break;
case EndTag:
{
NSLog(@"结束");
}
break;
case RejectTag:
case NewTag:
{
NSLog(@"拒绝");
NSLog(@"新建");
}
break;
case PassTag:
case AcceptTag:
{
NSLog(@"审核通过");
}
break;
case SureTag:
{
NSLog(@"确定");
NSLog(@"接受");
}
break;
default:
......@@ -191,13 +200,8 @@ typedef enum : NSUInteger {
}
- (void)createPurchaseView{
if (self.indexPerson == 0) {
_leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"最后修改人:",@"状态:",@"类型:",@"供应商:",@"供应商确认:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"];
}else if (self.indexPerson == 1) {
_leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"审核人:",@"状态:",@"类型:",@"供应商:",@"供应商确认:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"];
}else{
_leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"审核人:",@"状态:",@"供应商:",@"其他费用:",@"总金额:",@"备注:"];
}
_leftArr = @[@"单号:",@"创建人:",@"标题:",@"状态:",@"状态:",@"采购员:",@"合计基础数量:",@"备注:"];
_purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*_leftArr.count +LeftMargin)];
_purchaseView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_purchaseView];
......@@ -216,92 +220,64 @@ typedef enum : NSUInteger {
if (i == 0) {
self.billNumberLabel = rightLabel;
}else if (i == 1) {
self.noticeNumberLabel = rightLabel;
}else if(i == 2){
self.createOperNameLabel = rightLabel;
}else if(i == _leftArr.count - 3){
self.otherPriceLabel = rightLabel;
}else if(i == _leftArr.count - 2){
self.totalPriceLabel = rightLabel;
}else if(i == 2){
self.titleLabel = rightLabel;
}else if(i == 3){
self.stateLabel = rightLabel;
}else if(i == 4){
self.userLabel = rightLabel;
}else if(i == 4){
self.countLabel = rightLabel;
}else if(i == _leftArr.count - 1){
rightLabel.numberOfLines = 0;
self.noteLabel = rightLabel;
}
if (self.indexPerson == 0 || self.indexPerson == 1) {
if (self.indexPerson == 0) {
if (i == 3) {
self.lastModifyNameLabel = rightLabel;
}
}else{
if (i == 3) {
self.checkNameLabel = rightLabel;
}
}
if(i == 4){
self.stateLabel = rightLabel;
}else if(i == 5){
self.typeLabel = rightLabel;
}else if(i == 6){
self.vendorNameLabel = rightLabel;
}else if(i == 7){
self.vendorIsSureLabel = rightLabel;
}else if(i == 8){
self.warehouseLabel = rightLabel;
}
}else{
if(i == 3){
self.checkNameLabel = rightLabel;
}else if(i == 4){
self.stateLabel = rightLabel;
}else if(i == 5){
self.vendorNameLabel = rightLabel;
}
}
[_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.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];
}
......
//
// NoticeProduct.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface NoticeProduct : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *productUuid;//商品uuid
@property (nonatomic,strong)NSString *productCode;//商品代码
@property (nonatomic,strong)NSString *productName;//商品名称
@property (nonatomic,strong)NSNumber *qpc;//包装规格
@property (nonatomic,strong)NSString *packUnit;//包装单位
@property (nonatomic,strong)NSNumber *qpcQuantity;//包装数量
@property (nonatomic,strong)NSNumber *quantity;//基础数量
@property (nonatomic,strong)NSNumber *purchasedQuantity;//已采购数量
@property (nonatomic,strong)NSString *remark;//备注
@end
//
// NoticeProduct.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "NoticeProduct.h"
@implementation NoticeProduct
@end
//
// PurchaseNotice.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface PurchaseNotice : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *create_time;//创建时间
@property (nonatomic,strong)NSString *create_id;//创建人代码
@property (nonatomic,strong)NSString *create_operName;//创建人名称
@property (nonatomic,strong)NSString *lastModified_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码
@property (nonatomic,strong)NSString *lastModified_operName;//最后修改人名称
@property (nonatomic,strong)NSString *billnumber;//采购单号
@property (nonatomic,strong)NSNumber *version;//版本号
@property (nonatomic,strong)NSString *title;//标题
@property (nonatomic,strong)NSString *state;//状态
@property (nonatomic,strong)NSString *purchaserUuid;//采购员ID
@property (nonatomic,strong)NSString *purchaserCode;//采购员代码
@property (nonatomic,strong)NSString *purchaserName;//采购员名称
@property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,strong)NSArray *products;//商品
@end
//
// PurchaseNotice.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseNotice.h"
@implementation PurchaseNotice
@end
//
// NoticeProductViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "NoticeProduct.h"
typedef void(^ChoseNoticeProduct)(NoticeProduct *noticeProduct,NSIndexPath *indexPath);
typedef void(^DeleteNoticeProduct)(NoticeProduct *accountDetail,NSIndexPath *indexPath);
@interface NoticeProductViewController : ICRBaseViewController
@property (nonatomic,strong)NoticeProduct *noticeProduct;
@property (nonatomic,copy)ChoseNoticeProduct choseNoticeProduct;
@property (nonatomic,copy)DeleteNoticeProduct deleteNoticeProduct;
@property (nonatomic,strong)NSIndexPath *indexPath;
@property (nonatomic,strong)NSString *navTitle;
@end
//
// NoticeProductViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "NoticeProductViewController.h"
#import "SurveyCell.h"
#import "HPGrowingTextView.h"
#import "ChooseProductViewController.h"
#import "ChooseProductUnitViewController.h"
#define LeftMargin 15
#define BtnHeight 44
#define TableRowHeight 46
#define CornerRadius 5
#define BtnSize 19
#define TotalHeight 230
#define KeyboardHeight 258
typedef enum : NSUInteger {
deleteTag = 10000,
SaveTag,
} BtnTag;
@interface NoticeProductViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{
UITableView *_tableView;
NSMutableArray *_dataArr;
UILabel *_chooseCostLabel;
UILabel *_choosePackUnitLabel;
UITextField *_qpcField;
UITextField *_qpcQuantityField;
UITextField *_quantityField;
HPGrowingTextView *_noteTextView;
}
@property (nonatomic,strong)NSString *productNameStr;
@property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productUuidStr;
@end
@implementation NoticeProductViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = self.navTitle;
[self initData];
[self createTableView];
}
- (void)initData{
_dataArr = [NSMutableArray array];
[_dataArr addObject:@"商品"];
[_dataArr addObject:@"包装单位"];
[_dataArr addObject:@"包装规格"];
[_dataArr addObject:@"包装数量"];
[_dataArr addObject:@"基础数量"];
[_dataArr addObject:@"备注"];
}
- (void)createTableView
{
self.view.backgroundColor = XXFBgColor;
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, LeftMargin,ScreenSize.width, ScreenSize.height - 64 - LeftMargin)) style:(UITableViewStylePlain)];
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.bounces = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:deleteTag image:nil title:@"删除" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_SAVE_COLOR];
[footView addSubview:saveBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(saveBtn.frame.origin.x + saveBtn.frame.size.width + LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_COMMIT_COLOR];
[footView addSubview:commitBtn];
_tableView.tableFooterView = footView;
[self.view addSubview:_tableView];
}
#pragma mark - 按钮点击事件
- (void)btnClick:(UIButton *)btn{
switch (btn.tag) {
case deleteTag://删除
{
if ([self checkCost]) {
if (self.indexPath) {
self.deleteNoticeProduct(self.noticeProduct,self.indexPath);
[self PopViewControllerAnimated:YES];
}else{
[self clearInfomation];
}
}
}
break;
case SaveTag:
{
if ([self checkCost]) {
self.choseNoticeProduct(self.noticeProduct,self.indexPath);
[self PopViewControllerAnimated:YES];
}
}
break;
default:
break;
}
}
- (void)clearInfomation{
_chooseCostLabel.text = @"选择商品";
_chooseCostLabel.textColor = GXF_PLACEHOLDER_COLOR;
_choosePackUnitLabel.text = @"选择包装单位";
_choosePackUnitLabel.textColor = GXF_PLACEHOLDER_COLOR;
_qpcField.text = @"";
_qpcQuantityField.text = @"";
_quantityField.text = @"";
}
- (BOOL)checkCost{
if (_chooseCostLabel.text.length == 0 ) {
ShowMessage(@"商品不能为空");
return NO;
}
if (_qpcField.text.length == 0 ) {
ShowMessage(@"包装规格不能为空");
return NO;
}
if (_qpcQuantityField.text.length == 0) {
ShowMessage(@"包装数量不能为空");
return NO;
}
if (_quantityField.text.length == 0) {
ShowMessage(@"基础数量不能为空");
return NO;
}
if (!self.noticeProduct) {
self.noticeProduct = [[NoticeProduct alloc]init];
}
self.noticeProduct.productCode = self.productCodeStr;
self.noticeProduct.productName = self.productNameStr;
self.noticeProduct.productUuid = self.productUuidStr;
self.noticeProduct.packUnit = _choosePackUnitLabel.text;
self.noticeProduct.qpc = [NSNumber numberWithFloat:[_qpcField.text floatValue]];
self.noticeProduct.qpcQuantity = [NSNumber numberWithFloat:[_qpcQuantityField.text floatValue]];
self.noticeProduct.quantity = [NSNumber numberWithFloat:[_quantityField.text floatValue]];
self.noticeProduct.remark = _noteTextView.text;
return YES;
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return _dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"cellID";
SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.row == 0 || indexPath.row == 1) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
[self createViewInCell:cell indexPath:indexPath];
}
[cell setTitleStr:_dataArr[indexPath.row]];
return cell;
}
- (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0 || indexPath.row == 1) {
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableRowHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) {
contentLabel.text = @"选择商品";
_chooseCostLabel = contentLabel;
}else if(indexPath.row == 1) {
contentLabel.text = @"选择包装单位";
_choosePackUnitLabel = contentLabel;
}
}else if (indexPath.row == _dataArr.count -1){
_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.font = GXF_FIFTEENTEN_SIZE;
_noteTextView.textAlignment = NSTextAlignmentRight;
_noteTextView.delegate = self;
_noteTextView.returnKeyType = UIReturnKeyDone;
_noteTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:_noteTextView];
}else{
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableRowHeight)];
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE;
textField.returnKeyType = UIReturnKeyDone;
textField.keyboardType = UIKeyboardTypeDecimalPad;
textField.delegate = self;
[cell.contentView addSubview:textField];
if (indexPath.row == 2) {
textField.placeholder = @"输入包装规格";
_qpcField = textField;
}else if(indexPath.row == 3){
textField.placeholder = @"输入包装数量";
_qpcQuantityField = textField;
}else{
textField.placeholder = @"输入基础数量";
_quantityField = textField;
}
}
if (self.noticeProduct) {
[self prepareDataIncell];
}
}
- (void)prepareDataIncell{
_chooseCostLabel.text = [NSString stringWithFormat:@"%@[%@]",self.noticeProduct.productName,self.noticeProduct.productCode];
self.productUuidStr = self.noticeProduct.productUuid;
self.productCodeStr = self.noticeProduct.productCode;
self.productNameStr = self.noticeProduct.productName;
_chooseCostLabel.textColor = GXF_CONTENT_COLOR;
_choosePackUnitLabel.text = self.noticeProduct.packUnit;
_choosePackUnitLabel.textColor = GXF_CONTENT_COLOR;
_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{
return TableRowHeight;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 0){
ChooseProductViewController *cvc = [ChooseProductViewController new];
cvc.choseBaseInfo = ^(NSArray *products){
Product *product=products [0];
_chooseCostLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_chooseCostLabel.textColor = GXF_CONTENT_COLOR;
self.productNameStr = product.name;
self.productUuidStr = product.uuid;
self.productCodeStr = product.code;
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
}else if(indexPath.row == 1){
ChooseProductUnitViewController *cvc = [ChooseProductUnitViewController new];
cvc.choseBaseInfo = ^(NSArray *products){
if (products.count > 0) {
GXFProductUnit *productUnit=products [0];
_choosePackUnitLabel.text = [NSString stringWithFormat:@"%@",productUnit.name];
_choosePackUnitLabel.textColor = GXF_CONTENT_COLOR;
}
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
}
}
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[_noteTextView resignFirstResponder];
return YES;
}
- (void)keyboardHidden{
[_qpcField resignFirstResponder];
[_qpcQuantityField resignFirstResponder];
[_quantityField resignFirstResponder];
[_noteTextView resignFirstResponder];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// PurchaseNoticeListCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PurchaseNotice.h"
@interface PurchaseNoticeListCell : UITableViewCell
@property (nonatomic,strong)UILabel *billNumberLabel;//采购单号
@property (nonatomic,strong)UILabel *titleLabel;//标题
@property (nonatomic,strong)UILabel *userLabel;//采购员
@property (nonatomic,strong)UILabel *createOperNameLabel;//创建人
@property (nonatomic,strong)UILabel *createTimeLabel;//创建时间
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIButton *stateBtn;
@property (nonatomic,strong)PurchaseNotice *purchaseNotice;
@end
//
// PurchaseNoticeListCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/15.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseNoticeListCell.h"
#define TitleSize 16
#define LeftMargin 90
#define TopMargin 10
#define TitleHeight 20
#define TableHeight 120
@implementation PurchaseNoticeListCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self bulidLayout];
}
return self;
}
- (void)bulidLayout
{
self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
self.stateBtn.titleLabel.font = GXF_FOURTEENTH_SIZE;
[self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.stateBtn.enabled = NO;
self.billNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
self.billNumberLabel.textColor = GXF_CONTENT_COLOR;
self.billNumberLabel.font = GXF_SIXTEENTEH_SIZE;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.billNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.titleLabel.numberOfLines = 0;
self.titleLabel.textColor = GXF_CELL_COLOR;
self.titleLabel.font = GXF_FOURTEENTH_SIZE;
self.userLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.titleLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.userLabel.textColor = GXF_CELL_COLOR;
self.userLabel.font = GXF_FOURTEENTH_SIZE;
self.createOperNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.userLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.createOperNameLabel.textColor = GXF_CELL_COLOR;
self.createOperNameLabel.font = GXF_FOURTEENTH_SIZE;
self.createTimeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.createOperNameLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.createTimeLabel.textColor = GXF_CELL_COLOR;
self.createTimeLabel.font = GXF_FOURTEENTH_SIZE;
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin - TopMargin * 2, 1))];;
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.stateBtn];
[self.contentView addSubview:self.billNumberLabel];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.userLabel];
[self.contentView addSubview:self.createOperNameLabel];
[self.contentView addSubview:self.createTimeLabel];
[self.contentView addSubview:self.lineLabel];
}
- (void)setPurchaseNotice:(PurchaseNotice *)purchaseNotice{
self.billNumberLabel.text = [NSString stringWithFormat:@"单号:%@",purchaseNotice.billnumber];
self.titleLabel.text = [NSString stringWithFormat:@"标题:%@",purchaseNotice.title];
self.userLabel.text = [NSString stringWithFormat:@"采购员:%@",purchaseNotice.purchaserName] ;
self.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",purchaseNotice.create_operName] ;
self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",purchaseNotice.create_time];
NSString *stateStr = @"";
if ([purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_INITIAL]) {
stateStr = @"未提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_NOTACCEPTED]) {
stateStr = @"未接受";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseNotice.state isEqualToString:PURCHASENOTICE_STATE_PURCHASEING]) {
stateStr = @"采购中";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseNotice.state isEqualToString:PURCHASE_STATE_FINISHED]) {
stateStr = @"已完成";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}
[self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
}
@end
......@@ -29,7 +29,7 @@ typedef enum : NSUInteger {
SaveTag = 2000,
CommitTag,
} BtnTag;
@interface ShopDetaileViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate,StartTimeViewDelegate>
@interface ShopDetaileViewController ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{
UITableView *_tableView;
NSMutableArray *_dataArr;
......@@ -63,7 +63,6 @@ typedef enum : NSUInteger {
self.title = self.navTitle;
[self initData];
[self setupSubviews];
// Do any additional setup after loading the view.
}
- (void)initData{
merchandise=[[UITextField alloc]init];
......@@ -84,9 +83,7 @@ typedef enum : NSUInteger {
}
-(void)setupSubviews
{
// self.view.backgroundColor = XXFBgColor;
{
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, 0,ScreenSize.width, ScreenSize.height - 64 - LeftMargin)) style:(UITableViewStylePlain)];
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.bounces = NO;
......@@ -100,9 +97,7 @@ typedef enum : NSUInteger {
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(saveBtn.frame.origin.x + saveBtn.frame.size.width + LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_COMMIT_COLOR];
[footView addSubview:commitBtn];
// [self.view addSubview:footView];
_tableView.tableFooterView = footView;
_tableView.tableFooterView = footView;
[self.view addSubview:_tableView];
}
......@@ -129,10 +124,6 @@ typedef enum : NSUInteger {
_PackagingLable.textColor=GXF_CONTENT_COLOR;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - 按钮点击事件
- (void)btnClick:(UIButton *)btn{
switch (btn.tag) {
......@@ -149,15 +140,10 @@ typedef enum : NSUInteger {
{
[self clearShopDetail];
}
}else
{
[self clearShopDetail];
}
// if ([self checkSurvey]) {
// [self saveSurvey:@"initial" message:@"正在保存..."];
// }
}
break;
case CommitTag:
......@@ -167,7 +153,6 @@ typedef enum : NSUInteger {
shopDetail.IsDeleted=NO;
self.choseShopDetail(shopDetail);//回调
[self PopViewControllerAnimated:YES];
// [self saveSurvey:@"submitted" message:@"正在提交..."];
}
}
break;
......@@ -242,87 +227,6 @@ typedef enum : NSUInteger {
return YES;
}
#pragma mark - 保存
- (void)saveSurvey:(NSString *)state message:(NSString *)msg
{
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
[IBTLoadingView showTips:@"操作成功"];
[self clearAllInformation];
if (self.survey) {
[ICRUserUtil sharedInstance].needFresh = YES;
[self.navigationController popViewControllerAnimated:YES];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
id uuidObject = [NSNull null];
if(self.survey.uuid.length > 0){
uuidObject = self.survey.uuid;
}
id billNumberObject = [NSNull null];
if (self.survey.billNumber > 0) {
billNumberObject = self.survey.billNumber;
}
NSNumber *version = [NSNumber numberWithLong:0];
if (self.survey) {
version = self.survey.version;
}
NSDictionary *dict = @{@"uuid":uuidObject,
@"version":version,
@"billnumber":billNumberObject,
@"title":[IBTCommon checkString:self.titleStr],
@"state":state,
@"productUuid":[IBTCommon checkString:self.productUuidStr],
@"productCode":[IBTCommon checkString:self.productCodeStr],
@"productName":[IBTCommon checkString:self.productNameStr],
@"beginDate":[IBTCommon checkString:self.beginDateStr],
@"endDate":[IBTCommon checkString:self.endDateStr],
@"remark":[IBTCommon checkString:self.remarkStr],
@"users":self.users};
[IBTLoadingView showProgressLabel:msg];
[[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail];
}
- (void)clearAllInformation{
_productLabel.text = @"请输入商品";
_productLabel.textColor = GXF_PLACEHOLDER_COLOR;
// _startDateLabel.text = @"选择日期";
// _startDateLabel.textColor = GXF_PLACEHOLDER_COLOR;
// _endDateLabel.text = @"选择日期";
// _endDateLabel.textColor = GXF_PLACEHOLDER_COLOR;
// _personLabel.text = @"选择调研人员";
// _personLabel.textColor = GXF_PLACEHOLDER_COLOR;
_noteTextView.text = @"";
//清空数据
self.titleStr = @"";
self.productCodeStr = @"";
self.productNameStr = @"";
self.productUuidStr = @"";
self.beginDateStr = @"";
self.endDateStr = @"";
[self.users removeAllObjects];
self.remarkStr = @"";
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
......@@ -363,12 +267,10 @@ typedef enum : NSUInteger {
if (indexPath.row==0) {
_productLabel = contentLabel;
contentLabel.text = @"选择商品";
[self preferDataInProductLabel];
}else if (indexPath.row==3)
{
_PackagingLable = contentLabel;
contentLabel.text = @"选择包装单位";
[self preferDataInProductLabel];
}
}else
......@@ -465,15 +367,6 @@ typedef enum : NSUInteger {
}
}
- (void)preferDataInProductLabel{
if (self.survey) {
_productLabel.text = [IBTCommon checkString:self.survey.productName];
_productLabel.textColor = GXF_CONTENT_COLOR;
self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
self.productNameStr = [IBTCommon checkString:self.survey.productName];
self.productUuidStr = [IBTCommon checkString:self.survey.productUuid];
}
}
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[_noteTextView resignFirstResponder];
......
......@@ -129,18 +129,6 @@ typedef enum : NSUInteger {
ShowMessage(@"尾款不能为空");
return NO;
}
if (![RegexUtil isValidateNmuberAndFloat:_actualmoneyField.text]) {
ShowMessage(@"应付金额不合法");
return NO;
}
if (![RegexUtil isValidateNmuberAndFloat:_paidmoneyField.text]) {
ShowMessage(@"已付金额额不合法");
return NO;
}
if (![RegexUtil isValidateNmuberAndFloat:_leftmoneyField.text]) {
ShowMessage(@"尾款不合法");
return NO;
}
if (!self.accountDetail) {
self.accountDetail = [[FeeAcountDetail alloc]init];
}
......@@ -232,8 +220,6 @@ typedef enum : NSUInteger {
_noteTextView.text = self.accountDetail.note;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableRowHeight;
}
......@@ -250,34 +236,17 @@ typedef enum : NSUInteger {
[self PushViewController:cvc animated:YES];
}
}
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[_noteTextView resignFirstResponder];
[self setTableFrame:LeftMargin];
return YES;
}
- (void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView{
CGFloat offset = ScreenSize.height - TotalHeight - KeyboardHeight;
if (offset < 0) {//上移
[self setTableFrame:LeftMargin+offset];
}
}
- (void)setTableFrame:(CGFloat)tabelH{
[UIView animateWithDuration:0.25 animations:^{
CGRect tableFrame = _tableView.frame;
tableFrame.origin.y = tabelH;
_tableView.frame = tableFrame;
}];
}
- (void)keyboardHidden{
[_actualmoneyField resignFirstResponder];
[_paidmoneyField resignFirstResponder];
[_leftmoneyField resignFirstResponder];
[_noteTextView resignFirstResponder];
[self setTableFrame:LeftMargin];
}
- (void)viewWillDisappear:(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