Commit 97c995b9 authored by 陈俊俊's avatar 陈俊俊

收货单

parent f605bbb8
This diff is collapsed.
......@@ -108,7 +108,7 @@
@"create_purchase",@"watch_purchase", @"watch_purchase", @"review_purchase",
@"create_transport",@"watch_transort", @"watch_transort",
@"create_process",@"watch_process", @"watch_process",
@"新建转运单", @"查看转运单", @"查看转运单"];
@"create_transfer", @"create_transfer", @"create_transfer"];
//NSArray *functionsSmallImgName = @[];
NSArray *functionItemTag = @[@(0),
......
......@@ -358,6 +358,33 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//1.添加转运单
- (void)saveTransferWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//2.获取转运单列表
- (void)queryTransferWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//3.获取转运单详情
- (void)getTransferResultWithTransferUuid:(NSString *)transferUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//4.结束转运单
- (void)endTransferWithTransferUuid:(NSString *)transferUuid
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//5.作废转运单
- (void)abortTransferWithTransferUuid:(NSString *)transferUuid
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end
......@@ -114,7 +114,17 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_QueryTransport,
XFFHttp_GetTransportDetail,
XFFHttp_EndTransport,
XFFHttp_AbortTransport
XFFHttp_AbortTransport,
//转运单
XFFHttp_QueryTransfer,
XFFHTTP_TransferSave,
XFFHttp_GetTransferDetail,
XFFHttp_EndTransfer,
XFFHttp_AbortTransfer,
};
static NSString * const ICRHTTPInterface[] = {
......@@ -211,6 +221,12 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_GetTransportDetail] = @"transport/get_transport",
[XFFHttp_EndTransport] = @"transport/finish",
[XFFHttp_AbortTransport] = @"transport/abort",
[XFFHTTP_TransferSave] = @"transfer/save_transfer",
[XFFHttp_QueryTransfer] = @"transfer/query_transfer",
[XFFHttp_GetTransferDetail] = @"transfer/get_transfer",
[XFFHttp_EndTransfer] = @"transfer/finish",
[XFFHttp_AbortTransfer] = @"transfer/abort",
};
static NSString * const ICRAttachmentTypeValue[] = {
......@@ -2592,4 +2608,174 @@ acceptTypeJson:YES
}
//获取转运单列表
- (void)queryTransferWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *urlStr = [[self class] UrlForPluginHTTPAction:XFFHttp_QueryTransfer];
[self POST:urlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//添加转运单
- (void)saveTransferWithData:(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:XFFHTTP_TransferSave] 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];
}
//获取转运单详情
- (void)getTransferResultWithTransferUuid:(NSString *)transferUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!transferUuid) {
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_GetTransferDetail] stringByAppendingFormat:@"/%@",transferUuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
- (void)endTransferWithTransferUuid:(NSString *)transferUuid
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!transferUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_EndTransfer] stringByAppendingFormat:@"/%@?version=%@&time=%@&operId=%@&operName=%@",transferUuid,version,[[NSDate date] httpParameterString],userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
- (void)abortTransferWithTransferUuid:(NSString *)transferUuid
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!transferUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_AbortTransfer] stringByAppendingFormat:@"/%@?version=%@&time=%@&operId=%@&operName=%@",transferUuid,version,[[NSDate date] httpParameterString],userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end
......@@ -26,6 +26,9 @@ typedef NS_ENUM (NSUInteger, ICRFunctionID) {
kFunctionSeeShipment, // 查看发运单
kFunctionNewProcessing, // 新增加工单
kFunctionSeeProcessing, // 查看加工单
kFunctionNewTransfer, //新建转运单
kFunctionSeeTransfer, //查看发运单
kFunctionSeeReceive, //查看收货单
kFunctionAnnouncement ,
......
......@@ -3,11 +3,12 @@
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "create_transport-2.png"
"filename" : "create_transfer.png"
},
{
"idiom" : "universal",
"scale" : "2x"
"scale" : "2x",
"filename" : "create_transfer@2x.png"
},
{
"idiom" : "universal",
......
......@@ -11,12 +11,12 @@
#define SetProductTotalPrice @"setProductTotalPrice"
#define KNOTIFICATION_getSelectPurchaseProduct @"KNOTIFICATION_getSelectPurchaseProduct"
#define KNOTIFICATION_ChoseTransportPurchase @"KNOTIFICATION_ChoseTransportPurchase"
#define KNOTIFICATION_ChoseTransportPurchase @"KNOTIFICATION_ChoseTransportPurchase"//选择采购单
#define KNOTIFICATION_ChoseTransportProduct @"KNOTIFICATION_ChoseTransportProduct"//选择发运单
#define KNOTIFICATION_AddPurchaseProduct @"KNOTIFICATION_AddPurchaseProduct"
#define KNOTIFICATION_AddTransportCost @"KNOTIFICATION_AddTransportCost"
#define KNOTIFICATION_changeIsSelectedFunctions @"KNOTIFICATION_changeIsSelectedFunctions"
......
......@@ -121,6 +121,8 @@
#define PurchaseUpdateDate @"purchaseUpdateDate"
#define TransportUpdateDate @"TransportUpdateDate"
#define PurchaseNoticeUpdateDate @"purchaseNoticeUpdateDate"
#define TransferUpdateDate @"TransferUpdateDate"
#define ChooseTransportUpdateDate @"ChooseTransportUpdateDate"
//行情调研状态
......@@ -180,6 +182,13 @@
#define TRANSPORT_STATE_RECEIVED @"received" //已收货
#define TRANSPORT_STATE_ABORTED @"aborted" //已废用
//发运单权限
#define TRANSPORT_ACTION_FINISH @"500404" //结束权
#define TRANSPORT_ACTION_ABORT @"500505" //作废权
//采购通知单状态
//initial("未提交"), notAccepted("未接受"), purchasing("采购中"), finished("已完成")
#define PURCHASENOTICE_STATE_INITIAL @"initial"
......@@ -193,6 +202,15 @@
#define NOTICE_PERMISSIONS_FINISH @"500306"//结束
//转运单状态
#define TRANSFER_STATE_INITIAL @"initial" //未提交
#define TRANSFER_STATE_UNRECEIVED @"unreceived"//待收货
#define TRANSFER_STATE_RECEIVED @"received" //已收货
#define TRANSFER_STATE_ABORTED @"aborted" //已废用
#define TRANSFER_ACTION_FINISH @"500604" //结束权
#define TRANSFER_ACTION_ABORT @"500605" //作废权
//选中的颜色
#define BASESELECT_COLOR RGBA(255, 127, 0, 1)
......
......@@ -26,6 +26,10 @@
#import "TransportViewController.h"
#import"PurchaseNoticeViewController.h"
#import "NewTransferViewController.h"
#import "TransferViewController.h"
#import "ReceiveViewController.h"
#import "GXFFunctionDB.h"
#import "GXFNewProcessViewController.h"
#import "GXFListProcessViewController.h"
......@@ -190,7 +194,22 @@
[self PushViewController:tVC animated:YES];
}
break;
// case kFunctionPatrolPlan://巡店计划
case kFunctionNewTransfer://新建转运单
{
NewTransferViewController *tVC = [[NewTransferViewController alloc] init];
tVC.title = @"新建转运单";
[self PushViewController:tVC animated:YES];
}
break;
case kFunctionSeeTransfer://转运单列表
{
TransferViewController *tVC = [[TransferViewController alloc] init];
tVC.title = @"转运单";
[self PushViewController:tVC animated:YES];
}
break;
// case kFunctionPatrolPlan://巡店计划
// {
// ICRPatrolPlanViewController *pVC = [[ICRPatrolPlanViewController alloc] initWithStore:nil isHomeShow:YES];
// [self PushViewController:pVC animated:YES];
......
......@@ -9,7 +9,7 @@
#import "GXFPopView.h"
#import "GXFPopCell.h"
#define GXFPOpView_LeftMargin 20
#define GXFPOpView_ContentHeight 200
#define GXFPOpView_ContentHeight 230
#define GXFPOpView_TopHeight 44
@interface GXFPopView ()<UITableViewDelegate,UITableViewDataSource>
......
//
// NewReceiveViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/10/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface NewReceiveViewController : ICRBaseViewController
@end
//
// NewReceiveViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/10/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "NewReceiveViewController.h"
@interface NewReceiveViewController ()
@end
@implementation NewReceiveViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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
//
// ReceiveDetailViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/10/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface ReceiveDetailViewController : ICRBaseViewController
@end
//
// ReceiveDetailViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/10/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ReceiveDetailViewController.h"
@interface ReceiveDetailViewController ()
@end
@implementation ReceiveDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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
//
// ReceiveViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/10/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface ReceiveViewController : ICRBaseViewController
@end
//
// ReceiveBoltView.h
// XFFruit
//
// Created by 陈俊俊 on 15/10/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol ReceiveBoltViewDelegate <NSObject>
- (void)getBoltValueSelectRow:(NSString *)state;
- (void)clearBoltInformation;
@end
@interface ReceiveBoltView : UIView<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <ReceiveBoltViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state;
@end
//
// ReceiveBoltView.m
// XFFruit
//
// Created by 陈俊俊 on 15/10/13.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ReceiveBoltView.h"
#import "MaskCell.h"
#define TableHeight 45
#define LeftMargin 80
#define TotalHeight 224
#define LeftHeight 44
#define BottomHeight 50
@interface ReceiveBoltView ()<UITextFieldDelegate>
{
UIView *_leftView;
UIButton *_currentBtn;
NSIndexPath *_currentIndexPath;
NSString *_state;
UIButton *_clearBtn;
}
@property (nonatomic,strong)NSString *state;
@end
@implementation ReceiveBoltView
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state{
self = [super initWithFrame:frame];
if (self) {
self.state = state;
[self createView];
[self createRightView];
[self preferData];
}
return self;
}
- (void)preferData{
if ([self.state isEqualToString:TRANSPORT_STATE_UNRECEIVED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([self.state isEqualToString:TRANSPORT_STATE_RECEIVED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}
}
#pragma mark - 创建视图
- (void)createView
{
_leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height- BottomHeight)];
[self addSubview:_leftView];
NSArray *arr = @[@"按状态"];
for (NSInteger i = 0; i<arr.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
[button setTitle:arr[i] forState:UIControlStateNormal];
[button setTitleColor:GXF_DETAIL_COLOR forState:UIControlStateNormal];
if (i == 0) {
button.enabled = NO;
_currentBtn = button;
}
[button setBackgroundImage:[UIImage imageNamed:@"maskEnable"] forState:UIControlStateDisabled];
[button setBackgroundImage:[UIImage imageNamed:@"mask"] forState:UIControlStateNormal];
button.tag = 1001+i;
[button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_leftView addSubview:button];
}
_clearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_clearBtn.frame = CGRectMake(0, CGRectGetMaxY(_leftView.frame), self.frame.size.width, BottomHeight);
[_clearBtn setTitle:@"清空选项" forState:UIControlStateNormal];
[_clearBtn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
_clearBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[_clearBtn addTarget:self action:@selector(clearBolt) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_clearBtn];
}
- (void)createRightView{
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height - BottomHeight) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self addSubview:self.tableView];
}
- (void)leftBtnClick:(UIButton *)btn{
_currentBtn.enabled = YES;
btn.enabled = NO;
_currentBtn = btn;
}
- (void)clearBolt{
if (_currentIndexPath) {
_currentIndexPath = nil;
[self.tableView reloadData];
}
if ([self.delegate respondsToSelector:@selector(clearBoltInformation)]) {
[self.delegate clearBoltInformation];
}
}
#pragma mark - 协议
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskID";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[MaskCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID totalWidth: ScreenSize.width - 80 totalHeight:TableHeight];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (_dataArr.count > 0) {
cell.Commitbtn.hidden = YES;
[cell setTitleStr:self.dataArr[indexPath.row]];
}
if (_currentIndexPath) {
if (indexPath.row == _currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//获取选中的cell
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
NSString *stateStr = @"";
if (indexPath.row == 0) {
stateStr = TRANSFER_STATE_UNRECEIVED;
}else if(indexPath.row == 1){
stateStr = TRANSFER_STATE_RECEIVED;
}
[self.delegate getBoltValueSelectRow:stateStr];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
@end
//
// ChooseTransportViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/10/11.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
typedef void(^GetTransferProduct)(NSArray *products);
@interface ChooseTransportViewController : ICRBaseViewController
@property (nonatomic,copy)GetTransferProduct getTransferProduct;
@end
//
// NewTransferViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "Transfer.h"
@interface NewTransferViewController : ICRBaseViewController
@property (nonatomic,strong)Transfer *transfer;
@end
//
// TransferDetailViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "Transfer.h"
@interface TransferDetailViewController : ICRBaseViewController
@property (nonatomic,strong)Transfer *transfer;
@end
//
// TransferProductViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface TransferProductViewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *transferProductArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame;
@property (nonatomic,assign)BOOL isHiddenEdit;
@property (nonatomic,strong)NSString *twoTitle;
@end
//
// TransferProductViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "TransferProductViewController.h"
#import "FooterCell.h"
#import "HeaderCell.h"
#import "TransferProductCell.h"
#import "TransferPdtDetail.h"
#import "GXFPopView.h"
#define TableHeight 44
#define ShowHeight 110
@interface TransferProductViewController ()
<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,HeaderCellDelegate,GXFPopViewDelegate>
{
CGRect _tableFrame;
NSMutableArray *_selectRowArr;//记录当前选中的cell
}
@property (nonatomic,strong)GXFPopView *popView;
@end
@implementation TransferProductViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = XXFBgColor;
[self initData];
[self createView];
}
- (void)initData{
_selectRowArr = [[NSMutableArray alloc]init];
if (!self.transferProductArr) {
self.transferProductArr = [NSMutableArray array];
}
}
- (void)setViewFrame:(CGRect)viewFrame{
_tableFrame = viewFrame;
}
- (void)createView{
self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.tableView];
NSArray *arr = @[@"商品",@"单价",@"包装数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:self.isHiddenEdit];
[self.view addSubview:headCell];
headCell.delegate = self;
self.tableView.tableHeaderView = headCell;
// if (!self.isHiddenEdit) {
// FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加商品明细" isTwo:self.twoTitle];
// [self.view addSubview:footCell];
// footCell.delegate = self;
// self.tableView.tableFooterView = footCell;
// }
}
#pragma mark - headCellDelegate
- (void)addClickList{
if (!self.popView) {
NSArray *arr = @[@"添加商品明细",@"选择采购单",@"选择发运单"];
self.popView = [[GXFPopView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height) withArr:arr];
self.popView.delegate = self;
[AppWindow addSubview:self.popView];
}
}
#pragma mark - popViewdelegate
- (void)selectRowTitle:(NSString *)str{
if (self.popView) {
[self.popView removeFromSuperview];
self.popView= nil;
}
if ([str isEqualToString:@"添加商品明细"]) {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil];
}else if([str isEqualToString:@"选择采购单"]){
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_ChoseTransportPurchase object:nil];
}else if ([str isEqualToString:@"选择发运单"]){
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_ChoseTransportProduct object:nil];
}
}
- (void)clearFromSuper{
if (self.popView) {
[self.popView removeFromSuperview];
self.popView = nil;
}
}
#pragma mark - footerDelegate
- (void)addClick{
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil];
}
- (void)editClick:(UIButton *)btn{
TransferPdtDetail *pdDetail = self.transferProductArr[btn.tag];
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil userInfo:@{@"transferPdtDetail":pdDetail,@"indexTag":@(btn.tag)}];
}
- (void)choosePurchase{
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_ChoseTransportPurchase object:nil];
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.transferProductArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"TransferProductCell";
TransferProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[TransferProductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID withImageName:@"edit"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (self.isHiddenEdit) {
cell.editBtn.hidden = YES;
}
}
if ([self isHaveIndexPath:indexPath]) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = ShowHeight + TableHeight -1;
cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = ShowHeight;
cell.showView.frame = showfrmame;
cell.backgroundColor = XXFBgColor;
}else{
cell.smallImageView.image = [UIImage imageNamed:@"arrowright"];
CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = TableHeight-1;
cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = 0;
cell.showView.frame = showfrmame;
cell.backgroundColor = [UIColor whiteColor];
}
cell.editBtn.tag = indexPath.row;
[cell.editBtn addTarget:self action:@selector(editClick:) forControlEvents:UIControlEventTouchUpInside];
if (self.transferProductArr.count > 0) {
TransferPdtDetail *billP = self.transferProductArr[indexPath.row];
[cell setPdtDetail:billP row:indexPath.row];
}
return cell;
}
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
for (NSIndexPath *path in _selectRowArr) {
if (path.row == indexPath.row) {
return YES;
}
}
return NO;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TransferProductCell *cell = (TransferProductCell *)[tableView cellForRowAtIndexPath:indexPath];
CGRect Linefrmame = cell.lineLabel.frame;
CGRect showfrmame = cell.showView.frame;
if (Linefrmame.origin.y == TableHeight - 1) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
Linefrmame.origin.y = ShowHeight + TableHeight - 1;
showfrmame.size.height = ShowHeight;
cell.backgroundColor = [UIColor whiteColor];
[_selectRowArr addObject:indexPath];
}else{
cell.smallImageView.image = [UIImage imageNamed:@"arrowright"];
Linefrmame.origin.y = TableHeight -1;
showfrmame.size.height = 0;
cell.backgroundColor = [UIColor whiteColor];
[_selectRowArr removeObject:indexPath];
}
cell.lineLabel.frame = Linefrmame;
cell.showView.frame = showfrmame;
[self.tableView reloadData];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if ([self isHaveIndexPath:indexPath]) {
return ShowHeight + TableHeight;
}
return TableHeight;
}
@end
//
// TransferViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
// 转运单列表
#import "ICRBaseViewController.h"
@interface TransferViewController : ICRBaseViewController
@end
//
// Transfer.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface Transfer : IBTModel
@property (nonatomic,strong)NSString *uuid; //唯一标识
@property (nonatomic,strong)NSString *billnumber; //调研单号
@property (nonatomic,strong)NSString *warehouseUuid; //仓库id
@property (nonatomic,strong)NSString *warehouseCode; //仓库代码
@property (nonatomic,strong)NSString *warehouseName; //仓库名称
@property (nonatomic,strong)NSString *rwarehouseUuid; //收货仓库id
@property (nonatomic,strong)NSString *rwarehouseCode; //收货仓库代码
@property (nonatomic,strong)NSString *rwarehouseName; //收货仓库名称
@property (nonatomic,strong)NSString *carnumber; //车牌号
@property (nonatomic,strong)NSString *state; //状态
@property (nonatomic,strong)NSString *type; //类型
@property (nonatomic,strong)NSString *carphone; //司机电话
@property (nonatomic,strong)NSString *note; //备注
@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)NSNumber *version; //版本
@property (nonatomic,strong)NSArray *pdtDetails;//商品
@property (nonatomic,strong)NSArray *accountDetails;//费用
@end
//
// Transfer.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "Transfer.h"
@implementation Transfer
@end
//
// TransferPdtDetail.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface TransferPdtDetail : IBTModel
@property (nonatomic,strong)NSString *uuid; //唯一标识
@property (nonatomic,strong)NSString *productUuid; //商品id
@property (nonatomic,strong)NSString *productCode; //商品代码
@property (nonatomic,strong)NSString *productName; //商品名称
@property (nonatomic,strong)NSString *sourcebillnumber; //来源单号
@property (nonatomic,strong)NSString *sourcePdtDetail; //来源单明细id
@property (nonatomic,strong)NSString *sourcetype ; //来源单类型
@property (nonatomic,strong)NSNumber *qpc; //包装规格
@property (nonatomic,strong)NSString *qpcStr; //包装规格描述
@property (nonatomic,strong)NSString *unit; //包装单位
@property (nonatomic,strong)NSNumber *packprice; //包装单价
@property (nonatomic,strong)NSString *baseUnit; //规格单位
@property (nonatomic,strong)NSNumber *qty; //转运的包装数量
@property (nonatomic,strong)NSNumber *price; //基础单价
@property (nonatomic,strong)NSNumber *baseQty; //转运的基础数量
@property (nonatomic,strong)NSNumber *total; //转运合计金额
@property (nonatomic,strong)NSString *note; //备注
@end
//
// TransferPdtDetail.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "TransferPdtDetail.h"
@implementation TransferPdtDetail
@end
//
// BottomTransferView.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TransferProductViewController.h"
#import "CostViewController.h"
#import "FeeAcountDetail.h"
#import "TransferPdtDetail.h"
@interface BottomTransferView : UIView
- (instancetype)initWithFrame:(CGRect)frame withHidden:(BOOL)isHidden;
@property (nonatomic,strong)TransferProductViewController *productVC;
@property (nonatomic,strong)CostViewController *costVC;
@property (nonatomic,assign)BOOL isHiddenEdit;
//添加或者编辑费用
- (void)refreshCost:(FeeAcountDetail *)fee indexPath:(NSIndexPath *)indexPath;
//删除费用
- (void)refreshDelCost:(FeeAcountDetail *)fee indexPath:(NSIndexPath *)indexPath;
//刷新费用
- (void)refreshCost:(NSArray *)costArr;
//刷新商品
- (void)refreshTranProduct:(NSArray *)tranProductArr;
- (void)reProduct:(NSArray *)tranProductArr;
//删除商品
- (void)refreshDelProduct:(TransferPdtDetail *)fee tag:(NSInteger)indexTag;
//添加
- (void)refreshProduct:(TransferPdtDetail *)transportPdtDetail;
- (void)refreshEditProduct:(TransferPdtDetail *)transportPdtDetail tag:(NSInteger)indexTag;
@end
//
// BottomTransferView.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "BottomTransferView.h"
#import "TransportPdtDetail.h"
#import "FeeAcountDetail.h"
#define ContentHeight 44
#define BtnWidth 100
#define BeginTag 8000
#define SpaceWidth (ScreenSize.width - 100*2)/3
@interface BottomTransferView ()<UIScrollViewDelegate>
{
UIScrollView *_bottomSV;
UIImageView *_moveImageView;
UIButton *_currentBtn;
UIButton *_addBtn;
}
@end
@implementation BottomTransferView
- (instancetype)initWithFrame:(CGRect)frame withHidden:(BOOL)isHidden{
self = [super initWithFrame:frame];
if (self) {
self.isHiddenEdit = isHidden;
//界面
[self bulidLayout];
}
return self;
}
#pragma mark - 布局
- (void)bulidLayout
{
[self addChildView];
[self createBottomView];
}
- (void)createBottomView{
NSArray *arr = @[@"商品明细",@"费用明细"];
_bottomSV = [[UIScrollView alloc]initWithFrame:CGRectMake(0,ContentHeight + 4, ScreenSize.width, CGRectGetHeight(self.frame) - ContentHeight-2)];
_bottomSV.showsHorizontalScrollIndicator = NO;
_bottomSV.showsVerticalScrollIndicator = NO;
_bottomSV.pagingEnabled = YES;
_bottomSV.delegate = self;
_bottomSV.contentSize = CGSizeMake(ScreenSize.width * arr.count, CGRectGetHeight(_bottomSV.frame));
[self addSubview:_bottomSV];
for (NSInteger i = 0; i < arr.count; i++) {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:arr[i] forState:UIControlStateNormal];
btn.frame = CGRectMake(SpaceWidth + (BtnWidth+SpaceWidth) * i, 0, BtnWidth, ContentHeight);
[btn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
[btn setTitleColor:GXF_SAVE_COLOR forState:UIControlStateDisabled];
btn.titleLabel.font = GXF_SIXTEENTEH_SIZE;
btn.tag = i + BeginTag;
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btn];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetWidth(_bottomSV.frame) * i, 0, CGRectGetWidth(_bottomSV.frame), CGRectGetHeight(_bottomSV.frame))];
if (i == 0) {
view.backgroundColor = [UIColor redColor];
self.productVC.viewFrame = view.bounds;
self.productVC.isHiddenEdit = self.isHiddenEdit;
[view addSubview:self.productVC.view];
}else if(i == 1){
self.costVC.viewFrame = view.bounds;
self.costVC.isHiddenEdit = self.isHiddenEdit;
[view addSubview:self.costVC.view];
view.backgroundColor = [UIColor blueColor];
}
[_bottomSV addSubview:view];
}
_moveImageView = [[UIImageView alloc]initWithFrame:CGRectMake(SpaceWidth, ContentHeight, BtnWidth,4)];
_moveImageView.image = [UIImage imageNamed:@"tab_line"];
UILabel *lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0, ContentHeight +1, ScreenSize.width, 1))];
lineLabel.backgroundColor = GXF_LINE_COLOR;
lineLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:lineLabel];
[self addSubview:_moveImageView];
}
- (void)addChildView{
self.productVC = [[TransferProductViewController alloc]init];
// self.productVC.twoTitle = @"";
self.costVC = [[CostViewController alloc]init];
}
- (void)btnClick:(UIButton *)btn{
NSInteger index = btn.tag - BeginTag;
_currentBtn.enabled = YES;
btn.enabled = NO;
_currentBtn = btn;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveFrame = _moveImageView.frame;
moveFrame.origin.x = SpaceWidth + (BtnWidth+SpaceWidth) * index;
_moveImageView.frame = moveFrame;
_bottomSV.contentOffset=CGPointMake(index * self.frame.size.width, 0);
}];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
CGFloat offsetX = scrollView.contentOffset.x / self.frame.size.width;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveFrame = _moveImageView.frame;
moveFrame.origin.x = SpaceWidth + (BtnWidth+SpaceWidth) * offsetX;
_moveImageView.frame = moveFrame;
}];
_currentBtn.enabled = YES;
UIButton *btn = (UIButton *) [self viewWithTag:offsetX + BeginTag];
btn.enabled = NO;
_currentBtn = btn;
}
//添加商品
- (void)refreshProduct:(TransportPdtDetail *)transportPdtDetail
{
if (self.productVC.transferProductArr) {
[self.productVC.transferProductArr addObject:transportPdtDetail];
[self.productVC.tableView reloadData];
}
}
//添加编辑
- (void)refreshCost:(FeeAcountDetail *)fee indexPath:(NSIndexPath *)indexPath{
if (indexPath) {
[self.costVC.costArr replaceObjectAtIndex:indexPath.row withObject:fee];
// NSArray *indexArray=[NSArray arrayWithObject:indexPath];
// [self.costVC.tableView reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationAutomatic];
[self.costVC.tableView reloadData];
}else{
if (self.costVC.costArr) {
[self.costVC.costArr addObject:fee];
[self.costVC.tableView reloadData];
}
}
}
//删除
- (void)refreshDelCost:(FeeAcountDetail *)fee indexPath:(NSIndexPath *)indexPath{
if (indexPath) {
[self.costVC.costArr removeObjectAtIndex:indexPath.row];
[self.costVC.tableView reloadData];
}
}
//刷新
- (void)refreshCost:(NSArray *)costArr{
NSMutableArray *feeArr = [NSMutableArray array];
for (NSDictionary *billDict in costArr) {
FeeAcountDetail *billProbuct = [FeeAcountDetail new];
[billProbuct setValuesForKeysWithDictionary:billDict];
[feeArr addObject:billProbuct];
}
self.costVC.costArr = feeArr;
[self.costVC.tableView reloadData];
}
- (void)refreshTranProduct:(NSArray *)tranProductArr{
NSMutableArray *productArr = [NSMutableArray array];
for (NSDictionary *billDict in tranProductArr) {
TransferPdtDetail *billProbuct = [TransferPdtDetail new];
[billProbuct setValuesForKeysWithDictionary:billDict];
[productArr addObject:billProbuct];
}
self.productVC.transferProductArr = productArr;
[self.productVC.tableView reloadData];
}
- (void)reProduct:(NSArray *)tranProductArr{
[self.productVC.transferProductArr addObjectsFromArray:tranProductArr];
[self.productVC.tableView reloadData];
}
- (void)refreshDelProduct:(TransferPdtDetail *)fee tag:(NSInteger)indexTag{
if (fee) {
[self.productVC.transferProductArr removeObjectAtIndex:indexTag];
[self.productVC.tableView reloadData];
}
}
- (void)refreshEditProduct:(TransferPdtDetail *)transportPdtDetail tag:(NSInteger)indexTag{
[self.productVC.transferProductArr replaceObjectAtIndex:indexTag withObject:transportPdtDetail];
[self.productVC.tableView reloadData];
}
@end
//
// TopTransferView.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "HPGrowingTextView.h"
#import "Transfer.h"
@protocol TopTransferViewDelegate <NSObject>
- (void)hiddenKeyBoard;
- (void)pushNextViewController:(id)vc;
@end
@interface TopTransferView : UIView
@property (nonatomic,strong)UILabel *rwarehouseLabel; //收货仓库
@property (nonatomic,strong)UILabel *warehouseLabel; //发货仓库
@property (nonatomic,strong)UITextField *carTextFiled; //车辆
@property (nonatomic,strong)UILabel *typeLabel; //运输类型
@property (nonatomic,strong)UITextField *phoneTextFiled; //电话
@property (nonatomic,strong)HPGrowingTextView *remarkTextView;//备注
@property (nonatomic,weak)id <TopTransferViewDelegate>delegate;
@property (nonatomic,strong)NSString *warehouseUuid;
@property (nonatomic,strong)NSString *warehouseCode;
@property (nonatomic,strong)NSString *warehouseName;
@property (nonatomic,strong)NSString *rwarehouseUuid;
@property (nonatomic,strong)NSString *rwarehouseCode;
@property (nonatomic,strong)NSString *rwarehouseName;
@property (nonatomic,strong)NSString *carnumber;
@property (nonatomic,strong)NSString *type;
@property (nonatomic,strong)NSString *carphone;
@property (nonatomic,strong)NSString *note;
@property (nonatomic,strong)Transfer *transfer;
@end
//
// TopTransferView.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "TopTransferView.h"
#import "SurveyCell.h"
#import "Warehouse.h"
#import "ChooseWarehouseViewController.h"
#import "ChooseTypeViewController.h"
#define LeftMargin 15
#define TopMargin 20
#define LeftWidth 80
#define TableHeight 44
#define SpaceHeight 10
@interface TopTransferView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{
UITableView *_tableView;
NSMutableArray *_dataArr;
}
@property (nonatomic,strong)NSString *selectType;
@property (nonatomic,strong)NSString *selectRwarehouse;
@property (nonatomic,strong)NSString *selectWarehouse;
@end
@implementation TopTransferView
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
//界面
[self bulidLayout];
}
return self;
}
#pragma mark - 布局
- (void)bulidLayout
{
self.backgroundColor = XXFBgColor;
_dataArr = [NSMutableArray array];
NSArray *arr = @[@"发货仓库:",@"收货仓库:",@"运输类型:",@"车辆:",@"司机电话:",@"备注:"];
[_dataArr addObjectsFromArray:arr];
_tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,self.frame.size.width, self.frame.size.height - TopMargin)) style:(UITableViewStylePlain)];
_tableView.backgroundColor = [UIColor whiteColor];
_tableView.bounces = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
[self addSubview:_tableView];
}
#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 || indexPath.row == 2) {
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 == 3 || indexPath.row == 4) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE;
textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self;
[cell.contentView addSubview:textField];
if (indexPath.row == 3) {
self.carTextFiled = textField;
self.carTextFiled.placeholder = @"请输入车辆";
}else if(indexPath.row == 4){
textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
textField.returnKeyType = UIReturnKeyDone;
self.phoneTextFiled = textField;
self.phoneTextFiled.placeholder = @"请输入司机电话";
}
}else if (indexPath.row == _dataArr.count -1){
self.remarkTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1;
self.remarkTextView.maxNumberOfLines = 1;
self.remarkTextView.isScrollable = YES;
self.remarkTextView.font = GXF_FIFTEENTEN_SIZE;
self.remarkTextView.textAlignment = NSTextAlignmentRight;
self.remarkTextView.delegate = self;
self.remarkTextView.returnKeyType = UIReturnKeyDone;
self.remarkTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:self.remarkTextView];
}else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) {
contentLabel.text = @"选择发货仓库";
self.warehouseLabel = contentLabel;
}else if(indexPath.row == 1){
contentLabel.text = @"选择收货仓库";
self.rwarehouseLabel = contentLabel;
}else if(indexPath.row == 2){
contentLabel.text = @"选择类型";
self.typeLabel = contentLabel;
}
}
}
- (void)setTransfer:(Transfer *)transfer{
if (transfer) {
if (transfer.warehouseName.length > 0) {
self.warehouseLabel.text = transfer.warehouseName;
self.warehouseLabel.textColor = GXF_CONTENT_COLOR;
self.warehouseCode = transfer.warehouseCode;
self.warehouseName = transfer.warehouseName;
self.warehouseUuid = transfer.warehouseUuid;
self.selectWarehouse = transfer.warehouseUuid;
}
if (transfer.type.length > 0) {
NSString *type = [transfer.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
self.typeLabel.text = type;
self.typeLabel.textColor = GXF_CONTENT_COLOR;
self.type = transfer.type;
self.selectType = transfer.type;
}
if (transfer.rwarehouseName.length > 0) {
self.rwarehouseLabel.text = transfer.rwarehouseName;
self.rwarehouseLabel.textColor = GXF_CONTENT_COLOR;
self.rwarehouseCode = transfer.rwarehouseCode;
self.rwarehouseName = transfer.rwarehouseName;
self.rwarehouseUuid = transfer.rwarehouseUuid;
self.selectRwarehouse = transfer.rwarehouseUuid;
}
if (transfer.carnumber.length > 0) {
self.carTextFiled.text = transfer.carnumber;
self.carnumber = transfer.carnumber;
}
if (transfer.carphone) {
self.phoneTextFiled.text = transfer.carphone;
self.carphone = transfer.carphone;
}
if (transfer.note) {
self.remarkTextView.text = transfer.note;
self.note = transfer.note;
}
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 0){
ChooseWarehouseViewController *cvc = [ChooseWarehouseViewController new];
if (self.selectWarehouse.length > 0) {
cvc.selectStr = self.selectWarehouse;
}
cvc.choseBaseInfo = ^(NSArray *warehouses){
if (warehouses.count > 0) {
Warehouse *warehouse = warehouses[0];
self.warehouseLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
self.warehouseLabel.textColor = GXF_CONTENT_COLOR;
self.warehouseUuid = warehouse.uuid;
self.warehouseCode = warehouse.code;
self.warehouseName = warehouse.name;
self.selectWarehouse = warehouse.uuid;
}
};
cvc.isMoreChose = NO;
[self.delegate pushNextViewController:cvc];
}else if(indexPath.row == 1){
ChooseWarehouseViewController *tvc = [[ChooseWarehouseViewController alloc]init];
if (self.selectRwarehouse.length > 0) {
tvc.selectStr = self.selectRwarehouse;
}
tvc.choseBaseInfo = ^(NSArray *warehouses){
if (warehouses.count > 0) {
Warehouse *warehouse = warehouses[0];
self.rwarehouseLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
self.rwarehouseLabel.textColor = GXF_CONTENT_COLOR;
self.rwarehouseUuid = warehouse.uuid;
self.rwarehouseCode = warehouse.code;
self.rwarehouseName = warehouse.name;
self.selectRwarehouse = warehouse.uuid;
}
};
[self.delegate pushNextViewController:tvc];
}else if(indexPath.row == 2){
ChooseTypeViewController *tvc = [[ChooseTypeViewController alloc]init];
if (self.selectType.length > 0) {
tvc.selectStr = self.selectType;
}
tvc.choseBaseInfo = ^(NSArray *types){
if (types.count > 0) {
NSString *type = types[0];
self.typeLabel.text = type;
self.selectType = type;
self.typeLabel.textColor = GXF_CONTENT_COLOR;
if ([type isEqualToString:@"紧急"]) {
self.type = GXF_Critical;
}else{
self.type = GXF_Normal;
}
}
};
[self.delegate pushNextViewController:tvc];
}
}
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[self.remarkTextView resignFirstResponder];
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[self.delegate hiddenKeyBoard];
return YES;
}
@end
//
// TransferBoltView.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol TransferBoltViewDelegate <NSObject>
- (void)getBoltValueSelectRow:(NSString *)state;
- (void)getuserLike:(NSString *)userLike;
- (void)getbillLike:(NSString *)billLike;
- (void)clearBoltInformation;
@end
@interface TransferBoltView : UIView<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <TransferBoltViewDelegate>delegate;
@property (nonatomic,strong)UITextField *userFiled;//采购单号类似于
@property (nonatomic,strong)UITextField *billFiled;//通知单号类似于
@property (nonatomic,strong)UITextField *creatorField;//供应商uuid类似于
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state userNumber:(NSString *)userNumber billNumber:(NSString *)billNumber;
@end
//
// TransferBoltView.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "TransferBoltView.h"
#import "MaskCell.h"
#define TableHeight 45
#define LeftMargin 80
#define TotalHeight 224
#define LeftHeight 44
#define BottomHeight 50
@interface TransferBoltView ()<UITextFieldDelegate>
{
UIView *_leftView;
UIButton *_currentBtn;
NSIndexPath *_currentIndexPath;
NSString *_state;
NSString *_billNumber;
NSString *_title;
UIButton *_clearBtn;
}
@property (nonatomic,strong)NSString *state;
@property (nonatomic,strong)NSString *billNumber;
@property (nonatomic,strong)NSString *userNumber;
@end
@implementation TransferBoltView
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state userNumber:(NSString *)userNumber billNumber:(NSString *)billNumber{
self = [super initWithFrame:frame];
if (self) {
self.userNumber = userNumber;
self.billNumber = billNumber;
self.state = state;
[self createView];
[self createRightView];
[self preferData];
}
return self;
}
- (void)preferData{
if ([self.state isEqualToString:TRANSPORT_STATE_INITIAL]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([self.state isEqualToString:TRANSPORT_STATE_UNRECEIVED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else if ([self.state isEqualToString:TRANSPORT_STATE_RECEIVED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
}else if ([self.state isEqualToString:TRANSPORT_STATE_ABORTED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:3 inSection:0];
}
self.userFiled.hidden = YES;
if(self.userNumber.length > 0){
self.userFiled.text = self.userNumber;
}
self.billFiled.hidden = YES;
if (self.billNumber.length > 0) {
self.billFiled.text = self.billNumber;
}
}
#pragma mark - 创建视图
- (void)createView
{
_leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height- BottomHeight)];
[self addSubview:_leftView];
NSArray *arr = @[@"按状态",@"创建人代码",@"调研单号"];
for (NSInteger i = 0; i<arr.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
[button setTitle:arr[i] forState:UIControlStateNormal];
[button setTitleColor:GXF_DETAIL_COLOR forState:UIControlStateNormal];
if (i == 0) {
button.enabled = NO;
_currentBtn = button;
}
[button setBackgroundImage:[UIImage imageNamed:@"maskEnable"] forState:UIControlStateDisabled];
[button setBackgroundImage:[UIImage imageNamed:@"mask"] forState:UIControlStateNormal];
button.tag = 1001+i;
[button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_leftView addSubview:button];
}
_clearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_clearBtn.frame = CGRectMake(0, CGRectGetMaxY(_leftView.frame), self.frame.size.width, BottomHeight);
[_clearBtn setTitle:@"清空选项" forState:UIControlStateNormal];
[_clearBtn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
_clearBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[_clearBtn addTarget:self action:@selector(clearBolt) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_clearBtn];
}
- (void)createRightView{
NSArray *arr = @[@"输入类似创建人代码",@"输入类似调研单号"];
UIView *contentView = [[UIView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height - BottomHeight)];
contentView.backgroundColor = [UIColor whiteColor];
[self addSubview:contentView];
UILabel *contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
contentLabel.font = GXF_FIFTEENTEN_SIZE;
contentLabel.text = @"类似于:";
[contentView addSubview:contentLabel];
for (NSInteger i = 0; i < arr.count; i ++) {
UITextField *contentField = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(contentLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
contentField.textAlignment = NSTextAlignmentLeft;
contentField.textColor = GXF_CONTENT_COLOR;
contentField.borderStyle = UITextBorderStyleRoundedRect;
contentField.font = GXF_FIFTEENTEN_SIZE;
contentField.placeholder = arr[i];
contentField.returnKeyType = UIReturnKeyDone;
contentField.delegate = self;
[contentView addSubview:contentField];
if (i == 0) {
self.userFiled = contentField;
}else if(i == 1){
self.billFiled = contentField;
}
}
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height - BottomHeight) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self addSubview:self.tableView];
}
- (void)leftBtnClick:(UIButton *)btn{
_currentBtn.enabled = YES;
btn.enabled = NO;
_currentBtn = btn;
[self keyBoardHidden];
switch (btn.tag) {
case 1001://状态
{
self.tableView.hidden = NO;
self.userFiled.hidden = YES;
self.billFiled.hidden = YES;
}
break;
case 1002://条件二
{
self.tableView.hidden = YES;
self.userFiled.hidden = NO;
self.billFiled.hidden = YES;
}
break;
case 1003://条件三
{
self.tableView.hidden = YES;
self.userFiled.hidden = YES;
self.billFiled.hidden = NO;
}
break;
default:
break;
}
}
- (void)clearBolt{
if (_billFiled.text.length > 0) {
_billFiled.text = @"";
}
if (_userFiled.text.length > 0) {
_userFiled.text = @"";
}
if (_currentIndexPath) {
_currentIndexPath = nil;
[self.tableView reloadData];
}
if ([self.delegate respondsToSelector:@selector(clearBoltInformation)]) {
[self.delegate clearBoltInformation];
}
}
#pragma mark - 协议
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaskID";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[MaskCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID totalWidth: ScreenSize.width - 80 totalHeight:TableHeight];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (_dataArr.count > 0) {
cell.Commitbtn.hidden = YES;
[cell setTitleStr:self.dataArr[indexPath.row]];
}
if (_currentIndexPath) {
if (indexPath.row == _currentIndexPath.row) {
cell.Commitbtn.hidden = NO;
}else{
cell.Commitbtn.hidden = YES;
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//获取选中的cell
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
//initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
NSString *stateStr = @"";
if (indexPath.row == 0) {
stateStr = TRANSFER_STATE_INITIAL;
}else if(indexPath.row == 1){
stateStr = TRANSFER_STATE_UNRECEIVED;
}else if(indexPath.row == 2){
stateStr = TRANSFER_STATE_RECEIVED;
}else if(indexPath.row == 3){
stateStr = TRANSFER_STATE_ABORTED;
}
[self.delegate getBoltValueSelectRow:stateStr];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[self keyBoardHidden];
return YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self keyBoardHidden];
}
- (void)keyBoardHidden{
[self.userFiled resignFirstResponder];
[self.billFiled resignFirstResponder];
}
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == self.userFiled) {
// if (self.userFiled.text.length > 0) {
[self.delegate getuserLike:self.userFiled.text];
// }
}else if(textField == self.billFiled){
// if (self.billFiled.text.length > 0) {
[self.delegate getbillLike:self.billFiled.text];
// }
}
}
@end
//
// TransferCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Transfer.h"
@interface TransferCell : UITableViewCell
@property (nonatomic,strong)UILabel *billNumberLabel;//单号
@property (nonatomic,strong)UILabel *warehouseLabel;//发货仓库
@property (nonatomic,strong)UILabel *rwarehouseLabel;//收货仓库
@property (nonatomic,strong)UILabel *carnumberLabel;//车辆
@property (nonatomic,strong)UILabel *createOperNameLabel;//创建人
@property (nonatomic,strong)UILabel *createTimeLabel;//创建时间
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIButton *stateBtn;
@property (nonatomic,strong)Transfer *transfer;
@end
//
// TransferCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "TransferCell.h"
#define TitleSize 16
#define LeftMargin 90
#define TopMargin 10
#define TitleHeight 20
#define TableHeight 140
@implementation TransferCell
- (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.warehouseLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.billNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.warehouseLabel.numberOfLines = 0;
self.warehouseLabel.textColor = GXF_CELL_COLOR;
self.warehouseLabel.font = GXF_FOURTEENTH_SIZE;
self.rwarehouseLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.warehouseLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.rwarehouseLabel.numberOfLines = 0;
self.rwarehouseLabel.textColor = GXF_CELL_COLOR;
self.rwarehouseLabel.font = GXF_FOURTEENTH_SIZE;
self.carnumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.rwarehouseLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.carnumberLabel.textColor = GXF_CELL_COLOR;
self.carnumberLabel.font = GXF_FOURTEENTH_SIZE;
self.createOperNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.carnumberLabel.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.warehouseLabel];
[self.contentView addSubview:self.rwarehouseLabel];
[self.contentView addSubview:self.carnumberLabel];
[self.contentView addSubview:self.createOperNameLabel];
[self.contentView addSubview:self.createTimeLabel];
[self.contentView addSubview:self.lineLabel];
}
- (void)setTransfer:(Transfer *)transfer{
self.billNumberLabel.text = [NSString stringWithFormat:@"单号:%@",transfer.billnumber];
self.warehouseLabel.text = [NSString stringWithFormat:@"发货仓库:%@",transfer.warehouseName];
self.rwarehouseLabel.text = [NSString stringWithFormat:@"发货仓库:%@",transfer.rwarehouseName];
self.carnumberLabel.text = [NSString stringWithFormat:@"车辆:%@",transfer.carnumber] ;
self.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",transfer.create_operName] ;
self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",transfer.create_time];
NSString *stateStr = @"";
if ([transfer.state isEqualToString:TRANSFER_STATE_INITIAL]) {
stateStr = @"未提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([transfer.state isEqualToString:TRANSFER_STATE_UNRECEIVED]) {
stateStr = @"待收货";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([transfer.state isEqualToString:TRANSFER_STATE_RECEIVED]) {
stateStr = @"已收货";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}else if ([transfer.state isEqualToString:TRANSFER_STATE_ABORTED]) {
stateStr = @"已作废";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}
[self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// TransferProductCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TransferPdtDetail.h"
@interface TransferProductCell : UITableViewCell
@property (nonatomic,strong)UIImageView *smallImageView;
@property (nonatomic,strong)UIButton *editBtn;
@property (nonatomic,strong)UILabel *seqLabel;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *priceLabel;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIView *showView;
@property (nonatomic,strong)UILabel *showStandLabel;
@property (nonatomic,strong)UILabel *showCountLabel;
@property (nonatomic,strong)UILabel *showBaseCountLabel;
@property (nonatomic,strong)UILabel *showPriceLabel;
@property (nonatomic,strong)UILabel *showTotalLabel;
@property (nonatomic,strong)UILabel *showNoteLabel;
@property (nonatomic,strong)UILabel *showPurchaseLabel;
@property (nonatomic,strong)UILabel *showSourceNumberLabel;
@property (nonatomic,strong)NSString *rightImageName;
- (void)setPdtDetail:(TransferPdtDetail *)pdtDetail row:(NSInteger)row;
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withImageName:(NSString *)imageName;
@end
//
// TransferProductCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "TransferProductCell.h"
#define LeftMargin 13
#define TableHeight 44
#define SmallSize 10
#define SmallWidth 20
#define SpaceMargin 1
#define LeftWidth 45
#define RightWidth 30
#define ShowWidth 150
#define ShowHeight 20
@implementation TransferProductCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withImageName:(NSString *)imageName{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.rightImageName = imageName;
[self bulidLayout];
}
return self;
}
- (void)bulidLayout
{
CGFloat headWidth = (ScreenSize.width - LeftWidth*2 - SpaceMargin* (3 -1))/3;
self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
self.smallImageView.image = [UIImage imageNamed:@"arrowright"];
self.smallImageView.contentMode = UIViewContentModeScaleAspectFit;
self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.smallImageView.frame), 0, SmallWidth, TableHeight))];
self.seqLabel.textColor = GXF_CONTENT_COLOR;
self.seqLabel.text = @"13";
self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.textColor = GXF_CONTENT_COLOR;
self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.priceLabel.textAlignment = NSTextAlignmentCenter;
self.priceLabel.textColor = GXF_CONTENT_COLOR;
self.priceLabel.font = GXF_SIXTEENTEH_SIZE;
self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.countLabel.textAlignment = NSTextAlignmentCenter;
self.countLabel.textColor = GXF_CONTENT_COLOR;
self.countLabel.font = GXF_SIXTEENTEH_SIZE;
self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
self.showView.clipsToBounds = YES;
self.showStandLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.seqLabel.frame), 0, ShowWidth, ShowHeight))];
self.showStandLabel.textAlignment = NSTextAlignmentLeft;
self.showStandLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showStandLabel.font = GXF_THREETEENTH_SIZE;
self.showCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.showStandLabel.frame), 0, ShowWidth, ShowHeight))];
self.showCountLabel.textAlignment = NSTextAlignmentLeft;
self.showCountLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showCountLabel.font = GXF_THREETEENTH_SIZE;
self.showBaseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showStandLabel.frame), ShowWidth, ShowHeight))];
self.showBaseCountLabel.textAlignment = NSTextAlignmentLeft;
self.showBaseCountLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showBaseCountLabel.font = GXF_THREETEENTH_SIZE;
self.showPriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showCountLabel.frame), CGRectGetMaxY(self.showStandLabel.frame), ShowWidth, ShowHeight))];
self.showPriceLabel.textAlignment = NSTextAlignmentLeft;
self.showPriceLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showPriceLabel.font = GXF_THREETEENTH_SIZE;
self.showTotalLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showBaseCountLabel.frame), ShowWidth, ShowHeight))];
self.showTotalLabel.textAlignment = NSTextAlignmentLeft;
self.showTotalLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showTotalLabel.font = GXF_THREETEENTH_SIZE;
self.showNoteLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showCountLabel.frame), CGRectGetMaxY(self.showBaseCountLabel.frame), ShowWidth, ShowHeight))];
self.showNoteLabel.textAlignment = NSTextAlignmentLeft;
self.showNoteLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showNoteLabel.font = GXF_THREETEENTH_SIZE;
self.showPurchaseLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showTotalLabel.frame), ShowWidth+ 100, ShowHeight))];
self.showPurchaseLabel.textAlignment = NSTextAlignmentLeft;
self.showPurchaseLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showPurchaseLabel.text = @"来源类型:";
self.showPurchaseLabel.font = GXF_THREETEENTH_SIZE;
self.showSourceNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showStandLabel.frame), CGRectGetMaxY(self.showPurchaseLabel.frame), ShowWidth+ 100, ShowHeight))];
self.showSourceNumberLabel.textAlignment = NSTextAlignmentLeft;
self.showSourceNumberLabel.textColor = GXF_PLACEHOLDER_COLOR;
self.showSourceNumberLabel.font = GXF_THREETEENTH_SIZE;
self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.editBtn setImage:[UIImage imageNamed:self.rightImageName] forState:UIControlStateNormal];
self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth , TableHeight);
self.editBtn.contentMode = UIViewContentModeScaleAspectFit;
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin * 2, 1))];;
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.smallImageView];
[self.contentView addSubview:self.seqLabel];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.priceLabel];
[self.contentView addSubview:self.countLabel];
[self.contentView addSubview:self.editBtn];
[self.contentView addSubview:self.showView];
[self.showView addSubview:self.showStandLabel];
[self.showView addSubview:self.showCountLabel];
[self.showView addSubview:self.showBaseCountLabel];
[self.showView addSubview:self.showPriceLabel];
[self.showView addSubview:self.showPurchaseLabel];
[self.showView addSubview:self.showSourceNumberLabel];
[self.showView addSubview:self.showTotalLabel];
[self.showView addSubview:self.showNoteLabel];
[self.contentView addSubview:self.lineLabel];
}
- (void)setPdtDetail:(TransferPdtDetail *)pdtDetail row:(NSInteger)row{
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = pdtDetail.productName;
self.priceLabel.text = [NSString stringWithFormat:@"%@元",[pdtDetail.price stringValue]];
self.countLabel.text = [NSString stringWithFormat:@"%@%@",pdtDetail.qty,pdtDetail.unit];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",pdtDetail.qpc,pdtDetail.baseUnit];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",pdtDetail.qty,pdtDetail.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",pdtDetail.baseQty,pdtDetail.baseUnit];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",pdtDetail.packprice];
NSString *sourceT = @"";
if ([pdtDetail.sourcetype isEqualToString:@"none"]) {
sourceT = @"无";
}else if ([pdtDetail.sourcetype isEqualToString:@"purchase"]) {
sourceT = @"采购单";
}if ([pdtDetail.sourcetype isEqualToString:@"transport"]) {
sourceT = @"发运单";
}
self.showPurchaseLabel.text = [NSString stringWithFormat:@"来源类型:%@",sourceT];
self.showSourceNumberLabel.text = [NSString stringWithFormat:@"来源单号:%@",pdtDetail.sourcebillnumber.length > 0 ?pdtDetail.sourcebillnumber : @"无"];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",pdtDetail.total];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note ? pdtDetail.note :@"无"];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -128,7 +128,7 @@ typedef enum : NSUInteger {
ShowMessage(@"尾款不能为空");
return NO;
}
if ([_leftmoneyField.text floatValue] <= 0) {
if ([_leftmoneyField.text floatValue] < 0) {
ShowMessage(@"检查应付金额和已付金额是否正确");
return NO;
}
......
......@@ -32,8 +32,9 @@ typedef enum : NSUInteger {
id uuidObject;
id billNumberObject;
NSNumber *versionObject;
}
@property (nonatomic,strong)NSString *state;
@end
@implementation NewTransportViewController
......@@ -129,6 +130,7 @@ typedef enum : NSUInteger {
case SaveTag:
{
if ([self checkTransport]) {
self.state = TRANSFER_STATE_INITIAL;
[self getDataFromServer:TRANSPORT_STATE_INITIAL msg:@"正在保存..."];
}
}
......@@ -362,6 +364,7 @@ typedef enum : NSUInteger {
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
//提交
self.state = TRANSPORT_STATE_UNRECEIVED;
[self getDataFromServer:TRANSPORT_STATE_UNRECEIVED msg:@"正在提交..."];
}
}
......@@ -383,7 +386,12 @@ typedef enum : NSUInteger {
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
if(self.transport && [self.state isEqualToString:TRANSPORT_STATE_INITIAL]){
[ICRUserUtil sharedInstance].needFresh = YES;
}
}
/*
#pragma mark - Navigation
......
......@@ -49,7 +49,7 @@ typedef enum : NSUInteger {
[super viewDidLoad];
self.title = @"发运单详情";
[self bulifLayout];
[self getDataFromServer];
[self getDataFromServer];
}
- (void)getDataFromServer{
......
......@@ -259,7 +259,7 @@ typedef enum : NSUInteger {
_boltView.backgroundColor = XXFBgColor;
_boltView.delegate = self;
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"未提交",@"收货",@"已收货",@"已作废",nil];
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"未提交",@"收货",@"已收货",@"已作废",nil];
[_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _boltView.frame;
......
......@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
#import "PurchaseBill.h"
#import "Transport.h"
@interface TransportPurchaseCell : UITableViewCell<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
......@@ -24,6 +24,7 @@
@property (nonatomic,strong)NSMutableArray *selectArr;
- (void)setPurchaseBill:(PurchaseBill *)bill selectArr:(NSMutableArray *)selectArr;
- (void)setTransPort:(Transport *)bill selectArr:(NSMutableArray *)selectArr;
@end
......@@ -85,6 +85,16 @@
//重要
[self.secondTable reloadData];
}
- (void)setTransPort:(Transport *)bill selectArr:(NSMutableArray *)selectArr{
self.bgView.height = 92 + bill.pdtDetails.count * 44;
self.secondTable.height = self.bgView.height - 45;
self.titleLabel.text = [NSString stringWithFormat:@"发运单号:%@",bill.billnumber];
self.secondArr = [NSMutableArray array];
self.selectArr = selectArr;
[self.secondArr addObjectsFromArray:bill.pdtDetails];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
......
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