Commit 1c9a444b authored by zhu's avatar zhu

Merge branch 'DEV_20150805_001' of http://121.42.32.57/root/xffruit into DEV_20150805_001

parents bc476c75 02b8c8df
...@@ -60,4 +60,4 @@ SPEC CHECKSUMS: ...@@ -60,4 +60,4 @@ SPEC CHECKSUMS:
SDWebImage: 71b7cdc1d1721d6a82ed62889030225f2c249e29 SDWebImage: 71b7cdc1d1721d6a82ed62889030225f2c249e29
SSKeychain: 3f42991739c6c60a9cf1bbd4dff6c0d3694bcf3d SSKeychain: 3f42991739c6c60a9cf1bbd4dff6c0d3694bcf3d
COCOAPODS: 0.38.2 COCOAPODS: 0.37.1
This diff is collapsed.
...@@ -32,10 +32,65 @@ ...@@ -32,10 +32,65 @@
[self setupBMKMapMgr]; [self setupBMKMapMgr];
_m_appViewControllerMgr = [ICRAppViewControllerManager getAppViewControllerManager]; _m_appViewControllerMgr = [ICRAppViewControllerManager getAppViewControllerManager];
#pragma 版本更新
// [self enterpriseUpdate];
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
return YES; return YES;
} }
#pragma mark enterprise alertView 企业版提示
- (void)enterpriseUpdate{
NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSComparisonResult comResult = [self p_compareVersions: currentVersion betweenVersion2:@"后台返回的app版本"];//_versionModel.ClientVersion];
if (comResult == NSOrderedAscending) {
//299企业版的更新 @"有新的版本可供下载"
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"新版本" message: @"" delegate:self cancelButtonTitle:@"下次再说"otherButtonTitles: @"去下载", nil];//_versionModel.UpgradeRemark
// alertV.tag = alertVEnterprise;
// [alertV show];
}else{
[IBTLoadingView showProgressLabel:@"暂无新版本"];
}
}
- (void) alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"app下载的url"]];
}
}
//比较版本号
- (NSComparisonResult)p_compareVersions: (NSString *)version1 betweenVersion2: (NSString *)version2{
NSComparisonResult result = NSOrderedSame;
if ([version2 isEqualToString:@""]) {
result = NSOrderedDescending;
return result ;
}
NSMutableArray *a = (NSMutableArray *)[version1 componentsSeparatedByString:@"."];
NSMutableArray *b = (NSMutableArray *)[version2 componentsSeparatedByString:@"."];
while (a.count < b.count) {[ a addObject:@"0"];}
while (b.count < a.count) {[ b addObject:@"0"];}
for(int i = 0; i < a.count; ++i){
if ([[a objectAtIndex:i] integerValue] < [[b objectAtIndex:i] integerValue]) {
result = NSOrderedAscending;
break;
}else if ([[b objectAtIndex:i] integerValue] < [[a objectAtIndex:i] integerValue]){
result = NSOrderedDescending;
break;
}
}
return result;
}
- (void)applicationWillResignActive:(UIApplication *)application { - (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
......
...@@ -231,7 +231,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -231,7 +231,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
// 新增行情反馈(写)
- (void)surveySaveResultWithDict: (NSDictionary *)dict
surveyUuid: (NSString *)surveyUuid
success: (void (^)(id))succ
failure: (void (^)(id))fail;
//1.7 商品单位 //1.7 商品单位
- (void)getProductunitWithPage_number:(NSUInteger)page_number - (void)getProductunitWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size page_size:(NSUInteger)page_size
...@@ -252,7 +256,14 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -252,7 +256,14 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
//7.4 7.4 结束加工单(写)
- (void)finishProcessWithAuthenticode:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//7.5 作废加工单
- (void)abortProcessWithAuthenticode:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//1·保存采购通知单 //1·保存采购通知单
- (void)savePurchaseNoticeWithData:(id)data - (void)savePurchaseNoticeWithData:(id)data
success:(void (^)(id))succ success:(void (^)(id))succ
......
...@@ -86,6 +86,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -86,6 +86,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
//加工单 //加工单
XFFHttp_QueryProcess, XFFHttp_QueryProcess,
XFFHttp_GetProcess, XFFHttp_GetProcess,
XFFHttp_SaveProcess,
XFFHttp_FinishProcess,
XFFHttp_AbortProcess,
//采购通知单 //采购通知单
XFFHttp_savePurchaseNotice, XFFHttp_savePurchaseNotice,
XFFHttp_getPurchaseNoticeList, XFFHttp_getPurchaseNoticeList,
...@@ -167,8 +170,11 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -167,8 +170,11 @@ static NSString * const ICRHTTPInterface[] = {
//商品单位 //商品单位
[XFFHttp_GetProductunit] = @"data/productunit", [XFFHttp_GetProductunit] = @"data/productunit",
//加工单 //加工单
[XFFHttp_QueryProcess ] = @"process/query", [XFFHttp_QueryProcess ] = @"process/query",
[XFFHttp_GetProcess ] = @"process/get", [XFFHttp_GetProcess ] = @"process/get",
[XFFHttp_SaveProcess] = @"process/save",
[XFFHttp_FinishProcess] = @"process/finish",
[XFFHttp_AbortProcess] = @"process/abort",
//采购通知单 //采购通知单
[XFFHttp_savePurchaseNotice] = @"purchase/notice/save", [XFFHttp_savePurchaseNotice] = @"purchase/notice/save",
[XFFHttp_getPurchaseNoticeList] = @"purchase/notice/query", [XFFHttp_getPurchaseNoticeList] = @"purchase/notice/query",
...@@ -1741,7 +1747,10 @@ acceptTypeJson:YES ...@@ -1741,7 +1747,10 @@ acceptTypeJson:YES
fail( error ); fail( error );
} }
}; };
#pragma 请求参数的下载时间应该有要求????
#pragma 请求参数的下载时间应该有要求???? 加工工厂,用[NSDate date]可以获取到数据,但是供应商获取不到 ??
NSString *dateStr = @"2015-05-04";//[[NSDate date] httpParameterString];//urlAction NSString *dateStr = @"2015-05-04";//[[NSDate date] httpParameterString];//urlAction
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:urlAction] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:urlAction] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
...@@ -1764,7 +1773,79 @@ acceptTypeJson:YES ...@@ -1764,7 +1773,79 @@ acceptTypeJson:YES
} }
// 新增行情反馈(写)
- (void)surveySaveResultWithDict: (NSDictionary *)dict surveyUuid:(NSString *)surveyUuid success:(void (^)(id))succ failure:(void (^)(id))fail {
if (!dict || !surveyUuid) {
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 *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveyFinish] stringByAppendingFormat:@"/?survey_uuid=%@&time=%@&operId=%@&operName=%@",surveyUuid,currentTime,userUtil.userId,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//加工单
- (void)p_postFunctionWithAction: (NSUInteger)http_action
authenticode: (id)data
success: (void(^)(id))succ
failure: (void(^)(id))fail {
if (!data) {
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 );
}
};
NSDictionary *dict = data;
NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:http_action] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//7.1 保存加工单(写) //7.1 保存加工单(写)
- (void)saveProcessWithAuthenticode:(id)data success:(void (^)(id))succ failure:(void (^)(id))fail - (void)saveProcessWithAuthenticode:(id)data success:(void (^)(id))succ failure:(void (^)(id))fail
{ {
...@@ -1790,7 +1871,7 @@ acceptTypeJson:YES ...@@ -1790,7 +1871,7 @@ acceptTypeJson:YES
NSDictionary *dict = data; NSDictionary *dict = data;
NSString *currentTime = [[NSDate date] httpParameterString]; NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveySave] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SaveProcess] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr [self POST:encodeUrlStr
parameters:dict parameters:dict
...@@ -1819,14 +1900,10 @@ acceptTypeJson:YES ...@@ -1819,14 +1900,10 @@ acceptTypeJson:YES
}; };
NSDictionary *dict = data; NSDictionary *dict = data;
NSString *urlStr = [[self class] UrlForPluginHTTPAction:XFFHttp_QueryProcess ]; NSString *urlStr = [[self class] UrlForPluginHTTPAction:XFFHttp_QueryProcess ];
[self GET:urlStr [self POST:urlStr parameters:dict needToken:NO acceptTypeJson:YES success:success failure:failure];
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
} }
//7.3 加工单明细(读) [已实现] //7.3 加工单明细(读)
- (void)getResultWithProcessUuid:(NSString *)processUuid - (void)getResultWithProcessUuid:(NSString *)processUuid
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail { failure:(void (^)(id))fail {
...@@ -1865,7 +1942,18 @@ acceptTypeJson:YES ...@@ -1865,7 +1942,18 @@ acceptTypeJson:YES
} }
//7.4 7.4 结束加工单(写)
- (void)finishProcessWithAuthenticode:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail {
[self p_postFunctionWithAction:XFFHttp_FinishProcess authenticode:data success:succ failure:fail];
}
//7.5 作废加工单
- (void)abortProcessWithAuthenticode:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail {
}
//添加采购单 //添加采购单
- (void)savePurchaseWithData:(id)data - (void)savePurchaseWithData:(id)data
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
//Avatar //Avatar
#define KNOTIFICATION_saveMaterial @"KNOTIFICATION_saveMaterial" #define KNOTIFICATION_saveMaterial @"KNOTIFICATION_saveMaterial"
#define KNOTIFICATION_editMaterial @"KNOTIFICATION_editMaterial" #define KNOTIFICATION_editMaterial @"KNOTIFICATION_editMaterial"
#define KNOTIFICATION_deleteMaterial @"KNOTIFICATION_deleteMaterial"
#define KNOTIFICATION_saveProduct @"KNOTIFICATION_saveProduct" #define KNOTIFICATION_saveProduct @"KNOTIFICATION_saveProduct"
#define KNOTIFICATION_editProduct @"KNOTIFICATION_editProduct" #define KNOTIFICATION_editProduct @"KNOTIFICATION_editProduct"
......
...@@ -445,7 +445,10 @@ ...@@ -445,7 +445,10 @@
value = [value httpParameterString]; value = [value httpParameterString];
} }
if (value) { // if (value) {
if (!value) {
value = [NSNull null];
}
if ([arrCustomKeys containsObject:key] || if ([arrCustomKeys containsObject:key] ||
[arrLocalKeys containsObject:key]) { [arrLocalKeys containsObject:key]) {
continue; continue;
...@@ -455,7 +458,7 @@ ...@@ -455,7 +458,7 @@
[mDict addEntriesFromDictionary:@{key: value}]; [mDict addEntriesFromDictionary:@{key: value}];
} }
} }
} // }
free(properties); free(properties);
return mDict; return mDict;
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
+ (NSString *)stringFromDate:(NSDate*)aDate; + (NSString *)stringFromDate:(NSDate*)aDate;
+ (NSString*)dictionaryToJson:(id)dic; + (NSString*)dictionaryToJson:(id)dic;
+ (NSString *)checkString:(NSString *)str; + (NSString *)checkString:(NSString *)str;
+ (NSString *)checkNull: (id)data;
+ (BOOL)checkStringIsNilOrSpance: (NSString *)str; + (BOOL)checkStringIsNilOrSpance: (NSString *)str;
+ (NSMutableAttributedString *)setTextViewFontOfString:(NSString *)string paragraphStyle:(NSInteger)lineHeight fontSize:(float)size color:(UIColor *)color; + (NSMutableAttributedString *)setTextViewFontOfString:(NSString *)string paragraphStyle:(NSInteger)lineHeight fontSize:(float)size color:(UIColor *)color;
+ (NSString *)trimmingCharacters:(NSString *)str; + (NSString *)trimmingCharacters:(NSString *)str;
......
...@@ -198,6 +198,11 @@ ...@@ -198,6 +198,11 @@
return (str)?str:@""; return (str)?str:@"";
} }
+ (NSString *)checkNull:(id)data {
return data == [NSNull null] ? @"" : data;
}
+ (BOOL)checkStringIsNilOrSpance:(NSString *)str { + (BOOL)checkStringIsNilOrSpance:(NSString *)str {
if (!str || [str isEqualToString:@"" ] || [str isEqual:[NSNull null]]) { if (!str || [str isEqualToString:@"" ] || [str isEqual:[NSNull null]]) {
return YES; return YES;
......
...@@ -151,6 +151,12 @@ ...@@ -151,6 +151,12 @@
#define PURCHASE_PERMISSIONS_ABORT @"500408" #define PURCHASE_PERMISSIONS_ABORT @"500408"
//加工单状态
#define PROCESS_STATE_PROCESSINF @"processing"
#define PROCESS_STATE_ABORTED @"aborted"
#define PROCESS_STATE_FINISHED @"finished"
#define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show] #define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show]
//类型 //类型
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#import "GXFFunctionDB.h" #import "GXFFunctionDB.h"
#import "GXFNewProcessViewController.h" #import "GXFNewProcessViewController.h"
#import "GXFSeeProcessViewController.h" #import "GXFListProcessViewController.h"
@interface BusinessViewController ()<ICRFunctionBaseViewDelegate,UITableViewDataSource,UITableViewDelegate> @interface BusinessViewController ()<ICRFunctionBaseViewDelegate,UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong) ICRFunctionBaseView *c_functionBaseView; @property (nonatomic, strong) ICRFunctionBaseView *c_functionBaseView;
@property (nonatomic, strong) UITableView *c_tableView; @property (nonatomic, strong) UITableView *c_tableView;
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
} }
break; break;
case kFunctionSeeProcessing:{ case kFunctionSeeProcessing:{
GXFSeeProcessViewController *seeProcessVC= [[GXFSeeProcessViewController alloc]init]; GXFListProcessViewController *seeProcessVC= [[GXFListProcessViewController alloc]init];
[self PushViewController:seeProcessVC animated:YES]; [self PushViewController:seeProcessVC animated:YES];
} }
break; break;
......
//
// HGPhWViewController.h
// Cruiser
// 图片预览
// Created by freecui on 15/7/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTUIViewController.h"
#define kimgsFiles @"uploadImgsFiles"
@class HGPhotoWall;
@interface HGPhWViewController : IBTUIViewController
@property (strong, nonatomic)HGPhotoWall *photoWall;
@property (strong, nonatomic)NSString *url;
@property (strong, nonatomic) UIImage *img;
//@property (strong, nonatomic) NSMutableArray *phontosChooceMuArr;
//@property (strong, nonatomic) NSMutableArray *allImgsMuArr;//全部的照片的data数据
//@property (strong, nonatomic) NSMutableArray *allImgAssets;
+ (instancetype) shareInstance;
- (void)addOnePhoto: (UIImage *)img ;
- (void)addPhotosWithArrayImgs: (NSArray *)arr ;
@end
//
// HGPhWViewController.m
// Cruiser
// 图片预览
// Created by freecui on 15/7/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "HGPhWViewController.h"
#import "HGPhotoWall.h"
#import "HGPhoto.h"
#import "ZYQAssetPickerController.h"
#import "XFDB.h"
#import "XFPhoto.h"
@interface HGPhWViewController ()<HGPhotoWallDelegate,UIActionSheetDelegate,ZYQAssetPickerControllerDelegate,UINavigationControllerDelegate,UIScrollViewDelegate,UIImagePickerControllerDelegate>
@property (strong, nonatomic) UIView *coverV;
@property (strong, nonatomic) NSMutableArray *imgesMuArr;//每次从相册中选择的照片
//@property (strong, nonatomic) NSMutableArray *allImgsMuArr;
@property (strong, nonatomic) IBTUIButton *sureBtn;
@property (strong, nonatomic) UIScrollView *scrollV;
#define kImagCount 3
#define kPadding (20.0 / 320.0 * self.view.width)/(kImagCount + 1)
#define kImagWH ((self.view.width - (kImagCount + 1.0) * kPadding) / kImagCount)
#define KpaddingPhonto kPadding + kImagWH
@end
@implementation HGPhWViewController
static HGPhWViewController *_instance = nil;
+ (instancetype) shareInstance {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[self alloc]init];
});
return _instance;
}
// 重写init方法
- (id)init {
self = [super init];
if (!self) {
return nil;
}
//self.photoWall = [[HGPhotoWall alloc]init];
// [self initHGPhW];
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"图片预览";
[self initHGPhW];
[self initData];
}
- (void)viewDidDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] postNotificationName:kimgsFiles object:self];
}
- (void)initData {
self.imgesMuArr = [NSMutableArray array];
// self.allImgsMuArr = [NSMutableArray array];
// self.allImgAssets = [NSMutableArray array];
NSArray *arrData = [[XFDB sharedInstance]fetchAllPhotosFromLocal];
for (int count = 0; count < arrData.count; count ++) {
XFPhoto *xfphoto = arrData[count];
[self addOnePhoto:[UIImage imageWithData:xfphoto.photoData]];
}
}
- (void)initHGPhW {
self.edgesForExtendedLayout = NO;
// self.sureBtn = [IBTUIButton RoundCornerBtnWithTitle:@"确定上传图片" bgColor:nil];
// _sureBtn.frame = CGRectMake(10, self.view.height - 50 - 64, self.view.width - 20, 40);
// [_sureBtn addTarget:self action:@selector(surePhoto) forControlEvents:UIControlEventTouchUpInside];
// [_sureBtn setBackgroundColor:[UIColor redColor]];
// [self.view addSubview:_sureBtn];
self.scrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
[self.view addSubview:_scrollV];
self.photoWall = [[HGPhotoWall alloc]init];
_photoWall.backgroundColor = [UIColor yellowColor];
_photoWall.frame = (CGRect) {
.origin.x = 0,
.origin.y = 0,
.size.width = self.view.width,
.size.height = self.scrollV.height
};//self.view.bounds;
_photoWall.delegate = self;
#pragma 初始化原来的图片数据 从数据库中读出
[_photoWall setPhotos:nil];//
// @"http://www.weiphone.com/images_v3/logo.png",nil]];
[_photoWall setEditModel:YES];
//[self.view addSubview:_photoWall];
_scrollV.contentSize = _photoWall.size;
[_scrollV addSubview:_photoWall];
[self scrollViewContentHeight];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark -
#pragma mark 点击图片并放大
//- (void)photoWallPhotoTaped:(NSUInteger)index
//{
- (void)photoWallPhotoTaped:(HGPhoto*)hgPhoto {
[hgPhoto showImage];
// UIImageView *imgV = [[UIImageView alloc]init];
// imgV.frame = _coverV.bounds;
// [imgV setImageWithURL:self.photoWall]
// UIActionSheet *actionSheetTemp = [[UIActionSheet alloc] initWithTitle:nil
// delegate:self
// cancelButtonTitle:@"取消"
// destructiveButtonTitle:@"删除图片"
// otherButtonTitles:nil, nil];
// [actionSheetTemp showInView:self.view];
}
- (void)photoWallPhotoDel:(NSUInteger)index {
[_photoWall deletePhotoByIndex:index];
}
- (void)delCoverV {
if (_coverV) {
[_coverV removeFromSuperview];
}
}
- (void)photoWallMovePhotoFromIndex:(NSInteger)index toIndex:(NSInteger)newIndex
{
}
- (void)photoWallAddAction
{
// [self.photoWall addPhoto:_url];
// [self.photoWall addPhoto:@"http://cc.cocimg.com/bbs/attachment/upload/92/1226921340986127.jpg"];
[self.photoWall addPhotoImg:_img];
}
- (void)photoWallAddFinish
{
}
- (void)photoWallDeleteFinish
{
}
#pragma 增加一张照片
- (void)addOnePhoto: (UIImage *)img {
// [self.photoWall addPhoto:@"http://cc.cocimg.com/bbs/attachment/upload/92/1226921340986127.jpg"];
self.img = img;
[self.photoWall addPhotoImg:img];
NSLog(@"%@",NSStringFromCGRect(_photoWall.frame));
}
#pragma 增加多张照片
- (void)addPhotosWithArrayImgs:(NSArray *)arr {
for(UIImage *img in arr){
[self addOnePhoto:img];
}
}
#pragma 照片选择
- (void)photowallChoosePhontoes {
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"打开照相机", @"从手机相册获取", nil];
[actionSheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex) {
case 0:
[self openCamera];
break;
case 1:
[self libraryPhoto];
break;
default:
break;
}
}
- (void)openCamera {
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
UIImagePickerController *picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = sourceType;
[self PresentModalViewController:picker animated:YES];
}
- (void)libraryPhoto {
ZYQAssetPickerController *assetPicker = [[ZYQAssetPickerController alloc]init];
assetPicker.maximumNumberOfSelection = 10;
assetPicker.assetsFilter = [ALAssetsFilter allPhotos];
assetPicker.showEmptyGroups = NO;
assetPicker.delegate = self;
// assetPicker.indexPathsForSelectedItems = _allImgAssets;
assetPicker.selectionFilter = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
if ([[(ALAsset *)evaluatedObject valueForProperty:ALAssetPropertyType] isEqual:ALAssetTypeVideo]) {
NSTimeInterval duration = [[(ALAsset *)evaluatedObject valueForProperty:ALAssetPropertyDuration] doubleValue];
return duration >= 5;
} else {
return YES;
}
}];
[self PresentModalViewController:assetPicker animated:YES];
}
#pragma UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage];
[self addOnePhoto:img];
NSData *imgData = UIImagePNGRepresentation(img);
[self savePhotoToDB:imgData];
// [self.allImgsMuArr addObject:imgData];
[self scrollViewContentHeight];
[picker DismissModalViewControllerAnimated:YES];
}
#pragma 把选择的图片放入到本地数据库中
- (void)savePhotoToDB: (NSData *)imgData {
XFPhoto *xfphoto = [[XFPhoto alloc]initWithPhotoData:imgData];
BOOL isSave = [[XFDB sharedInstance]savePhoto:xfphoto];
if (isSave) {
NSLog(@"保存成功");
} else {
NSLog(@"保存失败");
}
}
#pragma mark - ZYQAssetPickerController Delegate
-(void)assetPickerController:(ZYQAssetPickerController *)picker didFinishPickingAssets:(NSArray *)assets{
if (_imgesMuArr.count > 0) {
[_imgesMuArr removeAllObjects];
}
// dispatch_async(dispatch_get_global_queue(0, 0), ^{
for (int i=0; i<assets.count; i++) {
ALAsset *asset = assets[i];
CGImageRef ref = [[asset defaultRepresentation]fullResolutionImage];
UIImage *img = [[UIImage alloc]initWithCGImage:ref];
NSData *imgData = UIImagePNGRepresentation(img);
[self savePhotoToDB:imgData];
// UIImage *tempImg = [UIImage imageWithCGImage:[asset po]];
[self.imgesMuArr addObject: img];//[UIImage imageNamed:@"AttachCamera"]
// [self.allImgsMuArr addObject:imgData];
}
[self addPhotosWithArrayImgs:_imgesMuArr];
// });
[self scrollViewContentHeight];
[picker popoverPresentationController];
}
#pragma 调整scrollView内容视图内容高度
- (void)scrollViewContentHeight {
NSArray *arr = [[XFDB sharedInstance] fetchAllPhotosFromLocal];
NSInteger count = 1;
if ((arr.count + 1) % kImagCount) {
count += (arr.count + 1) / kImagCount + 1;
} else {
count += (arr.count + 1) / kImagCount ;
}
self.photoWall.height = 15.0 / 568 * self.view.height + KpaddingPhonto * count;
self.scrollV.contentSize = _photoWall.size;
}
#pragma 确定选择的照片
- (void)surePhoto {
}
@end
//
// Photo.h
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import <UIKit/UIKit.h>
@class HGPhoto;
@protocol HGPhotoDelegate <NSObject>
@optional
- (void)photoTaped:(HGPhoto*)photo;
- (void)photoMoveFinished:(HGPhoto*)photo;
- (void)photoDel : (HGPhoto *)photo;
@end
typedef NS_ENUM(NSInteger, PhotoType) {
PhotoTypePhoto = 0, //Default
PhotoTypeAdd = 1,
};
@interface HGPhoto : UIView
@property (assign) id<HGPhotoDelegate> delegate;
- (id)initWithOrigin:(CGPoint)origin;
- (id)initWithOrigin:(CGPoint)origin andLength: (CGFloat)length;
- (void)setPhotoType:(PhotoType)type;
- (PhotoType)getPhotoType;
- (void)setPhotoUrl:(NSString*)photoUrl;
- (void)setPhotoImg : (UIImage *)img;
- (void)moveToPosition:(CGPoint)point;
- (void)setEditModel:(BOOL)edit;
- (void)showImage;//点击扩大图片
@end
//
// Photo.m
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import "HGPhoto.h"
#import <QuartzCore/QuartzCore.h>
#import "UIImageView+WebCache.h"
static CGRect oldframe;
@interface HGPhoto() <UIGestureRecognizerDelegate>
@property (strong, nonatomic) UIView *viewMask;
@property (strong, nonatomic) UIImageView *viewPhoto;
@property (strong, nonatomic) UIButton *delBtn;
@property (strong, nonatomic) NSString *stringImageUrl;
@property (nonatomic) CGPoint pointOrigin;
@property (nonatomic) BOOL editModel;
@property (nonatomic) PhotoType type;
@end
#define kPhotoSize 100. //75//
@implementation HGPhoto
- (id)initWithOrigin:(CGPoint)origin
{
self = [super initWithFrame:CGRectMake(origin.x, origin.y, kPhotoSize, kPhotoSize)];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.viewPhoto = [[UIImageView alloc] initWithFrame:self.bounds];
self.viewPhoto.layer.cornerRadius = 12;
self.viewPhoto.layer.masksToBounds = YES;
self.delBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_delBtn setBackgroundImage:[UIImage imageNamed:@"attachment_delete_btn"] forState:UIControlStateNormal];
CGFloat btnX = _viewPhoto.frame.size.width * 0.7;
CGFloat btnY = 0;
CGFloat btnW = _viewPhoto.frame.size.width - btnX;
_delBtn.frame = CGRectMake(btnX, btnY, btnW, btnW);
[_delBtn addTarget:self action:@selector(delphoto) forControlEvents:UIControlEventTouchUpInside];
[_viewPhoto addSubview:_delBtn];
self.viewMask = [[UIView alloc] initWithFrame:self.bounds];
self.viewMask.alpha = 0.6;
self.viewMask.backgroundColor = [UIColor blackColor];
self.viewMask.layer.cornerRadius = 11;
self.viewMask.layer.masksToBounds = YES;
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPress:)];
[self addSubview:self.viewPhoto];
[self addSubview:self.viewMask];
[self addGestureRecognizer:tapRecognizer];
self.editModel = NO;
self.viewMask.hidden = YES;
}
self.autoresizingMask = UIViewContentModeScaleAspectFill;
//self.autoresizingMask = UIViewAutoresizingFlexibleWidth & UIViewAutoresizingFlexibleHeight;
return self;
}
- (id)initWithOrigin:(CGPoint)origin andLength:(CGFloat)length {
self = [self initWithOrigin:origin];
self.viewPhoto.size = CGSizeMake(length, length);
self.size = CGSizeMake(length, length);
return self;
}
- (void)setPhotoType:(PhotoType)type
{
self.type = type;
if (type == PhotoTypeAdd) {
self.viewPhoto.image = [UIImage imageNamed:@"AttachCamera"];//@"addPhoto"];
[_delBtn removeFromSuperview];
}
}
- (PhotoType)getPhotoType
{
return self.type;
}
- (void)setPhotoUrl:(NSString*)photoUrl
{
[self.viewPhoto setImageWithURL:[NSURL URLWithString:photoUrl] placeholderImage:nil];
}
- (void)setPhotoImg:(UIImage *)img {
[self.viewPhoto setImage:img];
}
- (void)moveToPosition:(CGPoint)point
{
if (self.type == PhotoTypePhoto) {
[UIView animateWithDuration:0.5 animations:^{
self.frame = CGRectMake(point.x, point.y, self.frame.size.width, self.frame.size.height);
} completion:nil];
} else {
self.frame = CGRectMake(point.x, point.y, self.frame.size.width, self.frame.size.height);
}
}
- (void)setEditModel:(BOOL)edit
{
if (self.type == PhotoTypePhoto) {
if (edit) {
UILongPressGestureRecognizer *longPressreRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
longPressreRecognizer.delegate = self;
[self addGestureRecognizer:longPressreRecognizer];
} else {
for (UIGestureRecognizer *recognizer in [self gestureRecognizers]) {
if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
[self removeGestureRecognizer:recognizer];
break;
}
}
}
}
}
#pragma btn action
- (void)delphoto {
if ([self.delegate respondsToSelector:@selector(photoDel:)]) {
[self.delegate photoDel:self];
}
}
#pragma mark - UITapGestureRecognizer
- (void)tapPress: (UITapGestureRecognizer *)tap//(id)sender
{
//根据点击的位置不同去响应事件
CGMutablePathRef pathRef=CGPathCreateMutable();
CGPathMoveToPoint(pathRef, NULL, _delBtn.frame.origin.x, _delBtn.frame.origin.y);
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x, _delBtn.frame.origin.y);
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x + _delBtn.frame.size.width, _delBtn.frame.origin.y);
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x,_delBtn.frame.origin.y + _delBtn.frame.size.height );
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x + _delBtn.frame.size.width, _delBtn.frame.origin.y + _delBtn.frame.size.height);
CGPathCloseSubpath(pathRef);
CGPoint p = [tap locationInView:self];
if (CGPathContainsPoint(pathRef, NULL, p, NO)) {
NSLog(@"point in path!");
if ([self.delegate respondsToSelector:@selector(photoDel:)]) {
[self.delegate photoDel:self];
}
}
else {
NSLog(@"outPoint out path!");
if ([self.delegate respondsToSelector:@selector(photoTaped:)]) {
[self.delegate photoTaped:self];
}
}
}
- (void)handleLongPress:(id)sender
{
UILongPressGestureRecognizer *recognizer = sender;
CGPoint point = [recognizer locationInView:self];
CGFloat diffx = 0.;
CGFloat diffy = 0.;
if (UIGestureRecognizerStateBegan == recognizer.state) {
self.viewMask.hidden = NO;
self.pointOrigin = point;
[self.superview bringSubviewToFront:self];
} else if (UIGestureRecognizerStateEnded == recognizer.state) {
self.viewMask.hidden = YES;
if ([self.delegate respondsToSelector:@selector(photoMoveFinished:)]) {
[self.delegate photoMoveFinished:self];
}
} else {
diffx = point.x - self.pointOrigin.x;
diffy = point.y - self.pointOrigin.y;
}
CGFloat originx = self.frame.origin.x +diffx;
CGFloat originy = self.frame.origin.y +diffy;
self.frame = CGRectMake(originx, originy, self.frame.size.width, self.frame.size.height);
}
- (void)showImage {
UIImage *image = _viewPhoto.image;
UIWindow *window = [UIApplication sharedApplication].keyWindow;
UIView *backgroundView = [[UIView alloc]init];
backgroundView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
oldframe = [_viewPhoto convertRect:_viewPhoto.bounds toView:window ];
backgroundView.backgroundColor=[UIColor blackColor];
backgroundView.alpha = 0;
UIImageView *imageView = [[UIImageView alloc]init];
imageView.image = image;
imageView.tag = 1;
[backgroundView addSubview:imageView];
[window addSubview:backgroundView];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hideImage:)];
[backgroundView addGestureRecognizer:tap];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame = CGRectMake(
0,
([UIScreen mainScreen].bounds.size.height-image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width)/2,
[UIScreen mainScreen].bounds.size.width, image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width);
backgroundView.alpha = 1;
} completion:^(BOOL finished) {
}];
}
- (void)hideImage : (UITapGestureRecognizer *)tap {
UIView *backgroundView = tap.view;
UIImageView *imageView = (UIImageView *)[tap.view viewWithTag:1];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame = oldframe;
backgroundView.alpha = 0;
} completion:^(BOOL finished) {
[backgroundView removeFromSuperview];
}];
}
@end
//
// HGPhotoWall.h
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import <UIKit/UIKit.h>
@class HGPhoto;
@protocol HGPhotoWallDelegate <NSObject>
- (void)photoWallPhotoDel:(NSUInteger )index; //删除
- (void)photoWallPhotoTaped:(HGPhoto *)hgPhoto; //扩大图片
- (void)photoWallMovePhotoFromIndex:(NSInteger)index toIndex:(NSInteger)newIndex;
- (void)photoWallAddAction;
- (void)photoWallAddFinish;
- (void)photoWallDeleteFinish;
- (void)photowallChoosePhontoes;//从相册或相机中取照片
@end
@interface HGPhotoWall : UIView
@property (assign) id<HGPhotoWallDelegate> delegate;
- (void)setPhotos:(NSArray*)photos;
- (void)setEditModel:(BOOL)canEdit;
- (void)addPhoto:(NSString*)string;
- (void)addPhotoImg: (UIImage *)img;
- (void)deletePhotoByIndex:(NSUInteger)index;
@end
//
// ZYQAssetPickerController.h
// ZYQAssetPickerControllerDemo
//
// Created by Zhao Yiqi on 13-12-25.
// Copyright (c) 2013年 heroims. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AssetsLibrary/AssetsLibrary.h>
#pragma mark - ZYQAssetPickerController
@protocol ZYQAssetPickerControllerDelegate;
@interface ZYQAssetPickerController : UINavigationController
@property (nonatomic, weak) id <UINavigationControllerDelegate, ZYQAssetPickerControllerDelegate> delegate;
@property (nonatomic, strong) ALAssetsFilter *assetsFilter;
@property (nonatomic, copy, readonly) NSArray *indexPathsForSelectedItems;
@property (nonatomic, assign) NSInteger maximumNumberOfSelection;
@property (nonatomic, assign) NSInteger minimumNumberOfSelection;
@property (nonatomic, strong) NSPredicate *selectionFilter;
@property (nonatomic, assign) BOOL showCancelButton;
@property (nonatomic, assign) BOOL showEmptyGroups;
@property (nonatomic, assign) BOOL isFinishDismissViewController;
@end
@protocol ZYQAssetPickerControllerDelegate <NSObject>
-(void)assetPickerController:(ZYQAssetPickerController *)picker didFinishPickingAssets:(NSArray *)assets;
@optional
-(void)assetPickerControllerDidCancel:(ZYQAssetPickerController *)picker;
-(void)assetPickerController:(ZYQAssetPickerController *)picker didSelectAsset:(ALAsset*)asset;
-(void)assetPickerController:(ZYQAssetPickerController *)picker didDeselectAsset:(ALAsset*)asset;
-(void)assetPickerControllerDidMaximum:(ZYQAssetPickerController *)picker;
-(void)assetPickerControllerDidMinimum:(ZYQAssetPickerController *)picker;
@end
#pragma mark - ZYQAssetViewController
@interface ZYQAssetViewController : UITableViewController
@property (nonatomic, strong) ALAssetsGroup *assetsGroup;
@property (nonatomic, strong) NSMutableArray *indexPathsForSelectedItems;
@end
#pragma mark - ZYQVideoTitleView
@interface ZYQVideoTitleView : UILabel
@end
#pragma mark - ZYQTapAssetView
@protocol ZYQTapAssetViewDelegate <NSObject>
-(void)touchSelect:(BOOL)select;
-(BOOL)shouldTap;
@end
@interface ZYQTapAssetView : UIView
@property (nonatomic, assign) BOOL selected;
@property (nonatomic, assign) BOOL disabled;
@property (nonatomic, weak) id<ZYQTapAssetViewDelegate> delegate;
@end
#pragma mark - ZYQAssetView
@protocol ZYQAssetViewDelegate <NSObject>
-(BOOL)shouldSelectAsset:(ALAsset*)asset;
-(void)tapSelectHandle:(BOOL)select asset:(ALAsset*)asset;
@end
@interface ZYQAssetView : UIView
- (void)bind:(ALAsset *)asset selectionFilter:(NSPredicate*)selectionFilter isSeleced:(BOOL)isSeleced;
@end
#pragma mark - ZYQAssetViewCell
@protocol ZYQAssetViewCellDelegate;
@interface ZYQAssetViewCell : UITableViewCell
@property(nonatomic,weak)id<ZYQAssetViewCellDelegate> delegate;
- (void)bind:(NSArray *)assets selectionFilter:(NSPredicate*)selectionFilter minimumInteritemSpacing:(float)minimumInteritemSpacing minimumLineSpacing:(float)minimumLineSpacing columns:(int)columns assetViewX:(float)assetViewX;
@end
@protocol ZYQAssetViewCellDelegate <NSObject>
- (BOOL)shouldSelectAsset:(ALAsset*)asset;
- (void)didSelectAsset:(ALAsset*)asset;
- (void)didDeselectAsset:(ALAsset*)asset;
@end
#pragma mark - ZYQAssetGroupViewCell
@interface ZYQAssetGroupViewCell : UITableViewCell
- (void)bind:(ALAssetsGroup *)assetsGroup;
@end
#pragma mark - ZYQAssetGroupViewController
@interface ZYQAssetGroupViewController : UITableViewController
@end
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#import "GXFFunction.h" #import "GXFFunction.h"
#import "GXFNoticeFunctionTableViewCell.h" #import "GXFNoticeFunctionTableViewCell.h"
#import "GXFFunctionCollectionViewCell.h" #import "GXFFunctionCollectionViewCell.h"
#import "GXFSeeProcessViewController.h" #import "GXFListProcessViewController.h"
...@@ -282,7 +282,7 @@ static NSString *collectionCellID = @"collectionCell"; ...@@ -282,7 +282,7 @@ static NSString *collectionCellID = @"collectionCell";
} }
break; break;
case kFunctionSeeProcessing:{ case kFunctionSeeProcessing:{
GXFSeeProcessViewController *seeProcessVC= [[GXFSeeProcessViewController alloc]init]; GXFListProcessViewController *seeProcessVC= [[GXFListProcessViewController alloc]init];
[self PushViewController:seeProcessVC animated:YES]; [self PushViewController:seeProcessVC animated:YES];
} }
break; break;
......
//
// GXFSeeProcessViewController.h
// XFFruit
//
// Created by freecui on 15/9/4.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GXFListProcessViewController : UIViewController
@end
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
@interface GXFNewProcessViewController : UIViewController @interface GXFNewProcessViewController : UIViewController
- (instancetype)initWithProcessUuid: (NSString *)processUuid;
@end @end
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
// GXFSeeProcessViewController.h // GXFSeeProcessViewController.h
// XFFruit // XFFruit
// //
// Created by freecui on 15/9/4. // Created by freecui on 15/9/7.
// Copyright (c) 2015年 Xummer. All rights reserved. // Copyright (c) 2015年 Xummer. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface GXFSeeProcessViewController : UIViewController @interface GXFSeeProcessViewController : UIViewController
- (instancetype)initWithProcessUuid: (NSString *)processUuid;
@end @end
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
- (void)bottomViewleftButtonClicked: (UIButton *)leftBtn; - (void)bottomViewleftButtonClicked: (UIButton *)leftBtn;
- (void)bottomViewRightButtonClicked: (UIButton *)rightBtn; - (void)bottomViewRightButtonClicked: (UIButton *)rightBtn;
- (void)bottomViewOneButtonClicked: (UIButton *)oneBtn;
@end @end
@interface GXFBottomView : IBTUIView @interface GXFBottomView : IBTUIView
...@@ -24,6 +25,7 @@ typedef NS_ENUM(NSInteger, buttonTag){ ...@@ -24,6 +25,7 @@ typedef NS_ENUM(NSInteger, buttonTag){
@property (nonatomic, weak) id<GXFBottomViewDelegate>delegate; @property (nonatomic, weak) id<GXFBottomViewDelegate>delegate;
@property (nonatomic, strong) UIButton *f_leftBtn; @property (nonatomic, strong) UIButton *f_leftBtn;
@property (nonatomic, strong) UIButton *f_rightBtn; @property (nonatomic, strong) UIButton *f_rightBtn;
@property (nonatomic, strong) UIButton *f_oneBtn;
- (instancetype)initWithFrame:(CGRect)frame - (instancetype)initWithFrame:(CGRect)frame
LeftBtnTitle: (NSString *)leftTitle LeftBtnTitle: (NSString *)leftTitle
rightBtnTitle: (NSString *)rightTitle; rightBtnTitle: (NSString *)rightTitle;
...@@ -33,4 +35,8 @@ typedef NS_ENUM(NSInteger, buttonTag){ ...@@ -33,4 +35,8 @@ typedef NS_ENUM(NSInteger, buttonTag){
rightButtonColor: (UIColor *)rightBtnColor rightButtonColor: (UIColor *)rightBtnColor
LeftBtnTitle: (NSString *)leftTitle LeftBtnTitle: (NSString *)leftTitle
rightBtnTitle: (NSString *)rightTitle; rightBtnTitle: (NSString *)rightTitle;
- (instancetype)initOneButtonWithFrame:(CGRect)frame
buttonColor: (UIColor *)btnColor
buttonTitle: (NSString *)title;
@end @end
...@@ -74,4 +74,22 @@ ...@@ -74,4 +74,22 @@
} }
} }
- (instancetype)initOneButtonWithFrame:(CGRect)frame buttonColor:(UIColor *)btnColor buttonTitle:(NSString *)title {
self = [super initWithFrame:frame];
if (!self) {
return nil;
}
CGRect rect = CGRectMake(LEFT_PADDING, TOP_PADDING, frame.size.width - 2 * LEFT_PADDING, BUTTON_HEIGHT);
UIButton *btn = [IBTCustomButtom creatButtonWithFrame:rect target:self sel:@selector(oneBtnClicked) tag:0 image:nil title:title titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:btnColor];
self.f_oneBtn = btn;
[self addSubview:_f_oneBtn];
return self;
}
- (void)oneBtnClicked {
if ([_delegate respondsToSelector:@selector(bottomViewOneButtonClicked:)]) {
[_delegate bottomViewOneButtonClicked:_f_oneBtn];
}
}
@end @end
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@class GXFProcessMaterial;
@interface GXFPopNewMaterialViewController : UIViewController @interface GXFPopNewMaterialViewController : UIViewController
- (instancetype)initWithProcessMaterial: (GXFProcessMaterial *)processMaterial
isEdit: (BOOL) isEdited;
@end @end
...@@ -34,10 +34,21 @@ ...@@ -34,10 +34,21 @@
@property (nonatomic, strong) NSIndexPath *d_dateIndexPath; @property (nonatomic, strong) NSIndexPath *d_dateIndexPath;
@property (nonatomic, assign) BOOL d_hasSaved; @property (nonatomic, assign) BOOL d_hasSaved;
@property (nonatomic, strong) GXFBottomView *c_bottomV; @property (nonatomic, strong) GXFBottomView *c_bottomV;
@property (nonatomic, assign) BOOL d_isEdited;
@end @end
@implementation GXFPopNewMaterialViewController @implementation GXFPopNewMaterialViewController
- (instancetype)initWithProcessMaterial: (GXFProcessMaterial *)processMaterial
isEdit: (BOOL) isEdited {
self = [super init];
if (!self) {
return nil;
}
self.d_processMaterial = processMaterial;
self.d_isEdited = isEdited;
return self;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"新增原料明细"; self.title = @"新增原料明细";
...@@ -51,7 +62,10 @@ ...@@ -51,7 +62,10 @@
self.d_leftArr = @[@"原料商品:",@"入库日期:",@"产地:",@"品质描述:",@"基础数量",@"基础单价:",@"总金额:",@"备注:",]; self.d_leftArr = @[@"原料商品:",@"入库日期:",@"产地:",@"品质描述:",@"基础数量",@"基础单价:",@"总金额:",@"备注:",];
self.d_rightArr = @[@"选择商品",@"",@"输入产地",@"输入品质描述",@"基础数量",@"基础单价",@"总金额",@"输入备注内容"]; self.d_rightArr = @[@"选择商品",@"",@"输入产地",@"输入品质描述",@"基础数量",@"基础单价",@"总金额",@"输入备注内容"];
self.d_lableTextArr = @[@"斤",@"元",@"元"]; self.d_lableTextArr = @[@"斤",@"元",@"元"];
self.d_processMaterial = [[GXFProcessMaterial alloc]init]; if (!_d_processMaterial) {
self.d_processMaterial = [[GXFProcessMaterial alloc]init];
}
} }
- (void)initSubViews { - (void)initSubViews {
//self.view.backgroundColor = RGBA(0, 0, 0, 0.5); //self.view.backgroundColor = RGBA(0, 0, 0, 0.5);
...@@ -127,7 +141,7 @@ ...@@ -127,7 +141,7 @@
xfCell = [tableView dequeueReusableCellWithIdentifier:lblCell]; // xfCell = [tableView dequeueReusableCellWithIdentifier:lblCell]; //
if (!xfCell) { if (!xfCell) {
xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:lblCell textFieldPlaceholder:_d_rightArr[indexPath.row] hasLable:YES backLableText:_d_lableTextArr[indexPath.row - 4]]; xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:lblCell textFieldPlaceholder:_d_rightArr[indexPath.row] hasLable:YES backLableText:_d_lableTextArr[indexPath.row - 4]];
xfCell.f_textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
} }
} }
...@@ -138,6 +152,39 @@ ...@@ -138,6 +152,39 @@
xfCell.selectionStyle = UITableViewCellAccessoryNone; xfCell.selectionStyle = UITableViewCellAccessoryNone;
xfCell.f_textField.tag = indexPath.row; xfCell.f_textField.tag = indexPath.row;
xfCell.textLabel.text = _d_leftArr[indexPath.row]; xfCell.textLabel.text = _d_leftArr[indexPath.row];
if (_d_isEdited) {
switch (indexPath.row) {
case 0:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.productName];
break;
case 1:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.instockDate];//[NSString stringWithFormat:@"%@",_d_processProduct.outstockDate];
break;
case 2:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.place];//_d_processProduct.unit;
break;
case 3:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.quality];//[NSString stringWithFormat:@"%@",_d_processProduct.qpc];
break;
case 4:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.baseQty];//[NSString stringWithFormat:@"%@",_d_processProduct.quantity];
break;
case 5:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.basePrice];//[NSString stringWithFormat:@"%@",_d_processProduct.baseQty];
break;
case 6:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.total];//_d_processProduct.remark;
break;
case 7:
xfCell.f_textField.text = [IBTCommon checkNull:_d_processMaterial.remark];//_d_processProduct.remark;
break;
default:
break;
}
}
return xfCell; return xfCell;
} }
...@@ -257,13 +304,18 @@ ...@@ -257,13 +304,18 @@
#pragma GXFBottomViewDelegate #pragma GXFBottomViewDelegate
- (void)bottomViewleftButtonClicked:(UIButton *)leftBtn { - (void)bottomViewleftButtonClicked:(UIButton *)leftBtn {
if (_d_isEdited) {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_deleteMaterial object:_d_processMaterial];
}
} }
- (void)bottomViewRightButtonClicked:(UIButton *)rightBtn { - (void)bottomViewRightButtonClicked:(UIButton *)rightBtn {
self.d_hasSaved = YES; self.d_hasSaved = YES;
[self.c_bottomV.f_rightBtn setBackgroundColor:GXF_GRAY_COLOR]; [self.c_bottomV.f_rightBtn setBackgroundColor:GXF_GRAY_COLOR];
if (_d_isEdited) {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_saveMaterial object:_d_processMaterial]; [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_editMaterial object:_d_processMaterial];
} else {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_saveMaterial object:_d_processMaterial];
}
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
xfCell = [tableView dequeueReusableCellWithIdentifier:lblCell]; // xfCell = [tableView dequeueReusableCellWithIdentifier:lblCell]; //
if (!xfCell) { if (!xfCell) {
xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:lblCell textFieldPlaceholder:_d_rightArr[indexPath.row] hasLable:YES backLableText:_d_lableTextArr[indexPath.row - 3]]; xfCell = [[GXFTableViewCell alloc]initWithWidth:_c_tableView.width Style:UITableViewCellStyleDefault reuseIdentifier:lblCell textFieldPlaceholder:_d_rightArr[indexPath.row] hasLable:YES backLableText:_d_lableTextArr[indexPath.row - 3]];
xfCell.f_textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
} }
} }
...@@ -127,25 +127,26 @@ ...@@ -127,25 +127,26 @@
if (_d_isEdited) { if (_d_isEdited) {
switch (indexPath.row) { switch (indexPath.row) {
case 0: case 0:
xfCell.f_textField.text = _d_processProduct.productName; xfCell.f_textField.text = [IBTCommon checkNull:_d_processProduct.productName];//_d_processProduct.productName;
break; break;
case 1: case 1:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.outstockDate];
xfCell.f_textField.text = [IBTCommon checkNull:_d_processProduct.outstockDate];//[NSString stringWithFormat:@"%@",_d_processProduct.outstockDate];
break; break;
case 2: case 2:
xfCell.f_textField.text = _d_processProduct.unit; xfCell.f_textField.text = [IBTCommon checkNull:_d_processProduct.unit];//_d_processProduct.unit;
break; break;
case 3: case 3:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.qpc]; xfCell.f_textField.text = [IBTCommon checkNull:_d_processProduct.qpc];//[NSString stringWithFormat:@"%@",_d_processProduct.qpc];
break; break;
case 4: case 4:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.quantity]; xfCell.f_textField.text = [IBTCommon checkNull:_d_processProduct.quantity];//[NSString stringWithFormat:@"%@",_d_processProduct.quantity];
break; break;
case 5: case 5:
xfCell.f_textField.text = [NSString stringWithFormat:@"%@",_d_processProduct.baseQty]; xfCell.f_textField.text = [IBTCommon checkNull:_d_processProduct.baseQty];//[NSString stringWithFormat:@"%@",_d_processProduct.baseQty];
break; break;
case 6: case 6:
xfCell.f_textField.text = _d_processProduct.remark; xfCell.f_textField.text = [IBTCommon checkNull:_d_processProduct.remark];//_d_processProduct.remark;
break; break;
default: default:
break; break;
...@@ -168,6 +169,7 @@ ...@@ -168,6 +169,7 @@
_d_processProduct.productUuid = product.uuid; _d_processProduct.productUuid = product.uuid;
_d_processProduct.productCode = product.code; _d_processProduct.productCode = product.code;
_d_processProduct.productName = product.name; _d_processProduct.productName = product.name;
_d_processProduct.qpcStr = @"1 X123.0";//product.qpcStr;
} }
}; };
[self PushViewController:vc animated:YES]; [self PushViewController:vc animated:YES];
...@@ -250,7 +252,7 @@ ...@@ -250,7 +252,7 @@
// self.d_processProduct.productName = textField.text; // self.d_processProduct.productName = textField.text;
break; break;
case 2: case 2:
self.d_processProduct.unit = textField.text; self.d_processProduct.unit = @"筐";//textField.text;
break; break;
case 3: case 3:
self.d_processProduct.qpc = [NSNumber numberWithFloat:[textField.text floatValue]]; self.d_processProduct.qpc = [NSNumber numberWithFloat:[textField.text floatValue]];
...@@ -280,7 +282,7 @@ ...@@ -280,7 +282,7 @@
- (void)bottomViewRightButtonClicked:(UIButton *)rightBtn { - (void)bottomViewRightButtonClicked:(UIButton *)rightBtn {
self.d_hasSaved = YES; self.d_hasSaved = YES;
[self.c_bottomV.f_rightBtn setBackgroundColor:GXF_GRAY_COLOR]; [self.c_bottomV.f_rightBtn setBackgroundColor:GXF_GRAY_COLOR];
self.d_processProduct.unit = @"筐";
if (_d_isEdited) { if (_d_isEdited) {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_editProduct object:_d_processProduct]; [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_editProduct object:_d_processProduct];
} else { } else {
......
...@@ -37,5 +37,5 @@ ...@@ -37,5 +37,5 @@
//@property (nonatomic,copy)NSString *materials;原料明细 //@property (nonatomic,copy)NSString *materials;原料明细
//@property (nonatomic,copy)NSString *procucts;商品明细 //@property (nonatomic,copy)NSString *procucts;商品明细
- (instancetype )initWithDict: (NSDictionary *)dict;
@end @end
...@@ -9,5 +9,36 @@ ...@@ -9,5 +9,36 @@
#import "GXFProcessBill.h" #import "GXFProcessBill.h"
@implementation GXFProcessBill @implementation GXFProcessBill
- (instancetype)initWithDict:(NSDictionary *)dict {
self = [super init];
if (!self) {
self = nil;
}
self.uuid = dict[@"uuid"];
self.version = dict[@"version"];
self.billNumber = dict[@"billNumber"];
self.state = dict[@"state"];
self.title = dict[@"title"];
self.beginDate = dict[@"beginDate"];
self.endDate = dict[@"endDate"];
self.vendor_uuid = dict[@"vendor_uuid"];
self.vendor_code = dict[@"vendor_code"];
self.vendor_name = dict[@"vendor_name"];
self.warehouse_uuid = dict[@"warehouse_uuid"];
self.warehouse_code = dict[@"warehouse_code"];
self.warehouse_name = dict[@"warehouse_name"];
self.contact = dict[@"contact"];
self.contactPhone = dict[@"contactPhone"];
self.total = dict[@"total"];
self.remark = dict[@"remark"];
self.create_time = dict[@"create_time"];
self.create_id = dict[@"create_id"];
self.create_operName = dict[@"create_operName"];
self.lastModified_time = dict[@"lastModified_time"];
self.lastModified_id = dict[@"lastModified_id"];
self.lastModified_operName = dict[@"lastModified_operName"];
return self;
}
@end @end
//
// GXFProcessBoltView.h
// XFFruit
//
// Created by freecui on 15/9/7.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol GXFProcessBoltViewDelegate <NSObject>
- (void)getBoltValueSelectRow:(NSString *)state;
- (void)getbillLike:(NSString *)billLike;
- (void)getnoticeLike:(NSString *)noticeLike;
- (void)clearBoltInformation;
@end
@interface GXFProcessBoltView : UIView<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <GXFProcessBoltViewDelegate>delegate;
@property (nonatomic,strong)UITextField *billFiled;//采购单号类似于
//@property (nonatomic,strong)UITextField *noticeFiled;//通知单号类似于
@property (nonatomic,strong)UITextField *vendorFiled;//供应商uuid类似于
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state billNumber:(NSString *)billNumber noticeNumber:(NSString *)noticeNumber;
@end
This diff is collapsed.
//
// GXFProcessBillCell.h
// XFFruit
//
// Created by freecui on 15/9/7.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GXFProcessBill.h"
@interface GXFProcessCell : UITableViewCell
@property (nonatomic,strong)UILabel *billNumberLabel;//加工单号
@property (nonatomic,strong)UILabel *titleLabel;//标题
//@property (nonatomic,strong)UILabel *noticeNumberLabel;//采购通知单号
@property (nonatomic,strong)UILabel *createOperNameLabel;//创建人
@property (nonatomic,strong)UILabel *createTimeLabel;//创建时间
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIButton *stateBtn;
@property (nonatomic,strong)GXFProcessBill *processBill;
@end
This diff is collapsed.
...@@ -20,4 +20,5 @@ ...@@ -20,4 +20,5 @@
@property (nonatomic,strong) NSNumber *basePrice;//基础单价 @property (nonatomic,strong) NSNumber *basePrice;//基础单价
@property (nonatomic,strong) NSNumber *total;//金额 @property (nonatomic,strong) NSNumber *total;//金额
@property (nonatomic,copy) NSString *remark;//备注 @property (nonatomic,copy) NSString *remark;//备注
- (instancetype )initWithDict: (NSDictionary *)dict;
@end @end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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