Commit 9f218ce9 authored by Sandy's avatar Sandy

测试版1.2.27

parent d0e55781
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.2.24</string> <string>1.2.27</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2.24</string> <string>1.2.27</string>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define KNOTIFICATION_ChoseTransportPurchase @"KNOTIFICATION_ChoseTransportPurchase"//选择采购单 #define KNOTIFICATION_ChoseTransportPurchase @"KNOTIFICATION_ChoseTransportPurchase"//选择采购单
#define KNOTIFICATION_ChoseTransportProduct @"KNOTIFICATION_ChoseTransportProduct"//选择发运单 #define KNOTIFICATION_ChoseTransportProduct @"KNOTIFICATION_ChoseTransportProduct"//选择发运单
#define KNOTIFICATION_ChoseTransferProduct @"KNOTIFICATION_ChoseTransferProduct"//选择转运单 #define KNOTIFICATION_ChoseTransferProduct @"KNOTIFICATION_ChoseTransferProduct"//选择转运单
#define KNOTIFICATION_DeleteTransportPdtInPurchase @"KNOTIFICATION_DeleteTransportPdtInPurchase"
#define KNOTIFICATION_EditReceiveProduct @"KNOTIFICATION_EditReceiveProduct" #define KNOTIFICATION_EditReceiveProduct @"KNOTIFICATION_EditReceiveProduct"
......
...@@ -104,8 +104,8 @@ typedef enum : NSUInteger { ...@@ -104,8 +104,8 @@ typedef enum : NSUInteger {
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)]; UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
if (self.intertype == ShopDetailInterTypeTransport) { if (self.intertype == ShopDetailInterTypeTransport) {
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*2), BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"删除" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_SAVE_COLOR]; // UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*2), BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"删除" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_SAVE_COLOR];
[footView addSubview:saveBtn]; // [footView addSubview:saveBtn];
}else{ }else{
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"删除" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_SAVE_COLOR]; UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"删除" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_SAVE_COLOR];
......
...@@ -12,12 +12,17 @@ ...@@ -12,12 +12,17 @@
#import "PurchaseBillProduct.h" #import "PurchaseBillProduct.h"
#define TableHeight 44 #define TableHeight 44
#define ShowHeight 130 #define ShowHeight 130
#define HeaderHeight 40
@interface ReceiveProductViewController ()<UITableViewDataSource,UITableViewDelegate,HeaderCellDelegate> @interface ReceiveProductViewController ()<UITableViewDataSource,UITableViewDelegate,HeaderCellDelegate>
{ {
CGRect _tableFrame; CGRect _tableFrame;
NSMutableArray *_selectRowArr;//记录当前选中的cell NSMutableArray *_selectRowArr;//记录当前选中的cell
} }
//采购单号
@property (strong, nonatomic) NSMutableArray *arrBillNumber;
//按照采购单号区分之后的数据
@property (strong, nonatomic) NSMutableDictionary *dictData;
@end @end
@implementation ReceiveProductViewController @implementation ReceiveProductViewController
...@@ -36,8 +41,35 @@ ...@@ -36,8 +41,35 @@
} }
} }
- (void)setProductArr:(NSMutableArray *)productArr {
_productArr = productArr;
[self convertData];
}
- (void)convertData {
self.arrBillNumber = [NSMutableArray array];
self.dictData = [NSMutableDictionary dictionary];
for (TransferPdtDetail *pdt in self.productArr) {
NSString *sourceBillNumber = pdt.sourcebillnumber ? pdt.sourcebillnumber : @" ";
if (![self.arrBillNumber containsObject:pdt.sourcebillnumber]) {
[self.arrBillNumber addObject:sourceBillNumber];
}
NSMutableArray *arrTemp = [self.dictData objectForKey:sourceBillNumber];
if (!arrTemp) {
arrTemp = [NSMutableArray array];
[self.dictData setObject:arrTemp forKey:sourceBillNumber];
}
[arrTemp addObject:pdt];
}
}
- (void)setViewFrame:(CGRect)viewFrame{ - (void)setViewFrame:(CGRect)viewFrame{
_tableFrame = viewFrame; _tableFrame = viewFrame;
_tableView.frame = viewFrame;
} }
- (void)createView{ - (void)createView{
self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)]; self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)];
...@@ -46,7 +78,7 @@ ...@@ -46,7 +78,7 @@
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
NSArray *arr = @[@"商品",@"待收包装量",@"已收包装量"]; NSArray *arr = @[@"商品",@"待收包装数",@"已收包装数"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:self.isHiddenAdd]; HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:self.isHiddenAdd];
[self.view addSubview:headCell]; [self.view addSubview:headCell];
...@@ -60,11 +92,46 @@ ...@@ -60,11 +92,46 @@
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1; return self.arrBillNumber.count;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
NSString *sourceBillNumber = self.arrBillNumber[section];
if (sourceBillNumber.length == 1) {
return 0;
}else{
return HeaderHeight;
}
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenSize.width, HeaderHeight)];
header.backgroundColor = [UIColor whiteColor];
UILabel *transportBillNumber = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 250, HeaderHeight)];
[header addSubview:transportBillNumber];
transportBillNumber.text = [NSString stringWithFormat:@"[采购单:%@]",
self.arrBillNumber[section]];
transportBillNumber.textColor = GXF_GREEN_COLOR;
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, HeaderHeight - 1, IBT_MAIN_SCREEN_WIDTH, 1)];
line.backgroundColor = [UIColor colorWithWhite:0.835 alpha:1.000];
[header addSubview:line];
//删除按钮
// UIButton *btnDelete = [UIButton buttonWithType:UIButtonTypeCustom];
// btnDelete.frame = CGRectMake(IBT_MAIN_SCREEN_WIDTH - 16 - 30, (HeaderHeight - 30)/2, 30, 30);
// [btnDelete setImage:[UIImage imageNamed:@"xf_delete_pic"] forState:UIControlStateNormal];
// [header addSubview:btnDelete];
// btnDelete.tag = section;
// [btnDelete addTarget:self action:@selector(actionDeleteBillNumber:) forControlEvents:UIControlEventTouchUpInside];
return header;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.productArr.count; NSMutableArray *arrSection = [self.dictData objectForKey:self.arrBillNumber[section]];
return arrSection.count;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"ReceiveProductCell"; static NSString *cellID = @"ReceiveProductCell";
ReceiveProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; ReceiveProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
...@@ -101,6 +168,7 @@ ...@@ -101,6 +168,7 @@
TransferPdtDetail *billP = self.productArr[indexPath.row]; TransferPdtDetail *billP = self.productArr[indexPath.row];
[cell setBillProduct:billP row:indexPath.row defaultState:self.defaultState[indexPath.row]]; [cell setBillProduct:billP row:indexPath.row defaultState:self.defaultState[indexPath.row]];
} }
// cell.backgroundColor = [UIColor redColor];
return cell; return cell;
} }
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{ - (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
......
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
{ {
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)]; self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = transferProduct.productName; self.titleLabel.text = transferProduct.productName;
self.dscountLabel.text = [NSString stringWithFormat:@"%@%@",[transferProduct.qty stringValue],transferProduct.unit]; self.dscountLabel.text = [NSString stringWithFormat:@"%lu%@",transferProduct.qty.integerValue - transferProduct.rctQty.integerValue,transferProduct.unit];
self.yscountLabel.text = [NSString stringWithFormat:@"%@%@",transferProduct.rctQty?[transferProduct.rctQty stringValue]:@"0",transferProduct.unit]; self.yscountLabel.text = [NSString stringWithFormat:@"%@%@",transferProduct.rctQty?[transferProduct.rctQty stringValue]:@"0",transferProduct.unit];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",[transferProduct.qpc stringValue],transferProduct.baseUnit]; self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",[transferProduct.qpc stringValue],transferProduct.baseUnit];
self.showbzdwLabel.text = [NSString stringWithFormat:@"包装单位:%@",transferProduct.unit]; self.showbzdwLabel.text = [NSString stringWithFormat:@"包装单位:%@",transferProduct.unit];
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
_transportPdt = transportPdt; _transportPdt = transportPdt;
self.rctQty = transportPdt.receivedQty; self.rctQty = transportPdt.receivedQty;
self.rctBaseQty = transportPdt.receivedBaseQty; self.rctBaseQty = transportPdt.receivedBaseQty;
self.sourcebillnumber = transportPdt.purchasebillnumber;
} }
/** /**
......
...@@ -24,7 +24,7 @@ typedef enum : NSUInteger { ...@@ -24,7 +24,7 @@ typedef enum : NSUInteger {
} BtnTag; } BtnTag;
#define TopHeight 328 #define TopHeight 328
#define BottomHeight 300 #define BottomHeight 290
#define SpaceHeight 20 #define SpaceHeight 20
#define BottomViewHeight 60 #define BottomViewHeight 60
@interface NewTransportViewController ()<TopTransportViewDelegate,UIScrollViewDelegate,UIAlertViewDelegate> @interface NewTransportViewController ()<TopTransportViewDelegate,UIScrollViewDelegate,UIAlertViewDelegate>
...@@ -59,6 +59,7 @@ typedef enum : NSUInteger { ...@@ -59,6 +59,7 @@ typedef enum : NSUInteger {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(choseTransportPurchase) name:KNOTIFICATION_ChoseTransportPurchase object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(choseTransportPurchase) name:KNOTIFICATION_ChoseTransportPurchase object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addTransportCost:) name:KNOTIFICATION_AddTransportCost object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addTransportCost:) name:KNOTIFICATION_AddTransportCost object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addPurchaseProduct:) name:KNOTIFICATION_AddPurchaseProduct object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addPurchaseProduct:) name:KNOTIFICATION_AddPurchaseProduct object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteInPurchase:) name:KNOTIFICATION_DeleteTransportPdtInPurchase object:nil];
} }
return self; return self;
} }
...@@ -124,6 +125,42 @@ typedef enum : NSUInteger { ...@@ -124,6 +125,42 @@ typedef enum : NSUInteger {
} }
} }
- (void)deleteInPurchase:(NSNotification *)noti {
NSString *bill = noti.object;
[self deletePdtUnderPurchaseBillNumber:bill];
}
- (void)deletePdtUnderPurchaseBillNumber:(NSString *)billNumber {
NSMutableArray *arrInBill = [NSMutableArray array];
for (TransportPdtDetail *pdt in _bottomView.productVC.transportProductArr) {
if ([pdt.purchasebillnumber isEqualToString:billNumber]) {
[arrInBill addObject:pdt];
}
}
NSMutableArray *orign = _bottomView.productVC.transportProductArr.mutableCopy;
[orign removeObjectsInArray:arrInBill];
// if (self.transport) {
// self.transport.pdtDetails = orign;
// [self fetchtTransportDetail];
//
// }else{
_bottomView.productVC.transportProductArr = orign;
[_bottomView.productVC refresh];
//清空缓存,重新
[self.dicProduct removeAllObjects];
for (TransportPdtDetail *pdtDetail in _bottomView.productVC.transportProductArr) {
NSMutableArray *arrProduct = [self.dicProduct objectForKey:pdtDetail.purchasebillnumber];
if (!arrProduct) {
arrProduct = [NSMutableArray array];
[self.dicProduct setObject:arrProduct forKey:pdtDetail.purchasebillnumber];
}
[arrProduct addObject:pdtDetail];
}
// }
}
- (void)bulidLayout{ - (void)bulidLayout{
self.view.backgroundColor = XXFBgColor; self.view.backgroundColor = XXFBgColor;
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0, ScreenSize.width, ScreenSize.height- 64 - BottomViewHeight )]; _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0, ScreenSize.width, ScreenSize.height- 64 - BottomViewHeight )];
......
...@@ -250,21 +250,14 @@ typedef enum : NSUInteger { ...@@ -250,21 +250,14 @@ typedef enum : NSUInteger {
purchaseFrame.size.height = totalHeight + LeftMargin; purchaseFrame.size.height = totalHeight + LeftMargin;
_transportView.frame = purchaseFrame; _transportView.frame = purchaseFrame;
// if (self.type == TransportTypeAfterSubmit) {
// CGRect bottomFrame = _recieveBottomView.frame;
// bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin;
// _recieveBottomView.backgroundColor = [UIColor redColor];
// _recieveBottomView.frame = bottomFrame;
// _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_recieveBottomView.frame) + TopMargin*2 + 100);
// }else{
CGRect bottomFrame = _bottomView.frame; CGRect bottomFrame = _bottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin; bottomFrame.origin.y = CGRectGetMaxY(_transportView.frame) + TopMargin;
_bottomView.frame = bottomFrame; _bottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2); _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
// } CGRect frame = _transView.productVC.viewFrame;
_recieveBottomView.frame = frame;
_pvc.viewFrame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height - 10);
} }
...@@ -523,9 +516,9 @@ typedef enum : NSUInteger { ...@@ -523,9 +516,9 @@ typedef enum : NSUInteger {
[_recieveBottomView addSubview:_pvc.view]; [_recieveBottomView addSubview:_pvc.view];
} }
CGRect frame = _transView.productVC.view.frame; CGRect frame = _transView.productVC.viewFrame;
_recieveBottomView.frame = frame; _recieveBottomView.frame = frame;
_pvc.viewFrame = frame;
[_transView.productVC.view addSubview:_recieveBottomView]; [_transView.productVC.view addSubview:_recieveBottomView];
......
...@@ -14,4 +14,6 @@ ...@@ -14,4 +14,6 @@
@property (nonatomic,assign)CGRect viewFrame; @property (nonatomic,assign)CGRect viewFrame;
@property (nonatomic,assign)BOOL isHiddenEdit; @property (nonatomic,assign)BOOL isHiddenEdit;
@property (nonatomic,strong)NSString *twoTitle; @property (nonatomic,strong)NSString *twoTitle;
- (void)refresh;
@end @end
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define TableHeight 44 #define TableHeight 44
#define ShowHeight 130 #define ShowHeight 130
#define HeaderHeight 40
@interface TransportProductViewController () @interface TransportProductViewController ()
<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,HeaderCellDelegate,GXFPopViewDelegate> <UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,HeaderCellDelegate,GXFPopViewDelegate>
{ {
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
NSMutableArray *_selectRowArr;//记录当前选中的cell NSMutableArray *_selectRowArr;//记录当前选中的cell
} }
@property (nonatomic,strong)GXFPopView *popView; @property (nonatomic,strong)GXFPopView *popView;
//采购单号
@property (strong, nonatomic) NSMutableArray *arrBillNumber;
//按照采购单号区分之后的数据
@property (strong, nonatomic) NSMutableDictionary *dictData;
@end @end
@implementation TransportProductViewController @implementation TransportProductViewController
...@@ -41,7 +45,32 @@ ...@@ -41,7 +45,32 @@
} }
} }
- (void)setTransportProductArr:(NSMutableArray *)transportProductArr {
_transportProductArr = transportProductArr;
[self convertData];
}
- (void)convertData {
self.arrBillNumber = [NSMutableArray array];
self.dictData = [NSMutableDictionary dictionary];
for (TransportPdtDetail *pdt in self.transportProductArr) {
if (![self.arrBillNumber containsObject:pdt.purchasebillnumber]) {
[self.arrBillNumber addObject:pdt.purchasebillnumber];
}
NSMutableArray *arrTemp = [self.dictData objectForKey:pdt.purchasebillnumber];
if (!arrTemp) {
arrTemp = [NSMutableArray array];
[self.dictData setObject:arrTemp forKey:pdt.purchasebillnumber];
}
[arrTemp addObject:pdt];
}
}
- (void)setViewFrame:(CGRect)viewFrame{ - (void)setViewFrame:(CGRect)viewFrame{
_viewFrame = viewFrame;
_tableFrame = viewFrame; _tableFrame = viewFrame;
} }
- (void)createView{ - (void)createView{
...@@ -51,7 +80,7 @@ ...@@ -51,7 +80,7 @@
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
NSArray *arr = @[@"商品",@"单价",@"包装数量",@"已转运数"]; NSArray *arr = @[@"商品",@"待收包装数",@"已收包装数"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:self.isHiddenEdit]; HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:self.isHiddenEdit];
[self.view addSubview:headCell]; [self.view addSubview:headCell];
...@@ -101,8 +130,18 @@ ...@@ -101,8 +130,18 @@
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil];
} }
- (void)editClick:(UIButton *)btn{ - (void)editClick:(UIButton *)btn{
TransportPdtDetail *pdDetail = self.transportProductArr[btn.tag]; NSInteger section = btn.tag / 1000;
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil userInfo:@{@"transportPdtDetail":pdDetail,@"indexTag":@(btn.tag)}]; NSInteger row = btn.tag % 1000;
NSMutableArray *arrSection = [self.dictData objectForKey:self.arrBillNumber[section]];
TransportPdtDetail *pdDetail = arrSection[row];
NSInteger index = [self.transportProductArr indexOfObject:pdDetail];
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_AddPurchaseProduct object:nil userInfo:@{@"transportPdtDetail":pdDetail,@"indexTag":@(index)}];
}
- (void)refresh {
[self convertData];
[self.tableView reloadData];
} }
- (void)choosePurchase{ - (void)choosePurchase{
...@@ -111,10 +150,56 @@ ...@@ -111,10 +150,56 @@
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1; return self.arrBillNumber.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return HeaderHeight;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenSize.width, HeaderHeight)];
header.backgroundColor = [UIColor whiteColor];
UILabel *transportBillNumber = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 250, HeaderHeight)];
[header addSubview:transportBillNumber];
transportBillNumber.text = [NSString stringWithFormat:@"[采购单:%@]",
self.arrBillNumber[section]];
transportBillNumber.textColor = GXF_GREEN_COLOR;
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, HeaderHeight - 1, IBT_MAIN_SCREEN_WIDTH, 1)];
line.backgroundColor = [UIColor colorWithWhite:0.835 alpha:1.000];
[header addSubview:line];
//删除按钮
UIButton *btnDelete = [UIButton buttonWithType:UIButtonTypeCustom];
btnDelete.frame = CGRectMake(IBT_MAIN_SCREEN_WIDTH - 16 - 30, (HeaderHeight - 30)/2, 30, 30);
[btnDelete setImage:[UIImage imageNamed:@"xf_delete_pic"] forState:UIControlStateNormal];
[header addSubview:btnDelete];
btnDelete.tag = section;
[btnDelete addTarget:self action:@selector(actionDeleteBillNumber:) forControlEvents:UIControlEventTouchUpInside];
return header;
}
- (void)actionDeleteBillNumber:(UIButton *)btn {
NSString *billNumber = self.arrBillNumber[btn.tag];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:[NSString stringWithFormat:@"确认删除该采购单%@下的商品?", billNumber] preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDestructive) handler:^(UIAlertAction * _Nonnull action) {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_DeleteTransportPdtInPurchase object:billNumber];
}];
UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleDefault) handler:nil];
[alert addAction:actionYes];
[alert addAction:actionCancel];
[self presentViewController:alert animated:YES completion:nil];
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.transportProductArr.count; NSMutableArray *arrSection = [self.dictData objectForKey:self.arrBillNumber[section]];
return arrSection.count;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"TransportPurductCell"; static NSString *cellID = @"TransportPurductCell";
...@@ -145,18 +230,18 @@ ...@@ -145,18 +230,18 @@
cell.showView.frame = showfrmame; cell.showView.frame = showfrmame;
cell.backgroundColor = [UIColor whiteColor]; cell.backgroundColor = [UIColor whiteColor];
} }
cell.editBtn.tag = indexPath.row; cell.editBtn.tag = indexPath.section * 1000 + indexPath.row;
[cell.editBtn addTarget:self action:@selector(editClick:) forControlEvents:UIControlEventTouchUpInside]; [cell.editBtn addTarget:self action:@selector(editClick:) forControlEvents:UIControlEventTouchUpInside];
NSMutableArray *arrSection = [self.dictData objectForKey:self.arrBillNumber[indexPath.section]];
if (self.transportProductArr.count > 0) { if (arrSection.count > 0) {
TransportPdtDetail *billP = self.transportProductArr[indexPath.row]; TransportPdtDetail *billP = arrSection[indexPath.row];
[cell setPdtDetail:billP row:indexPath.row]; [cell setPdtDetail:billP row:indexPath.row];
} }
return cell; return cell;
} }
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{ - (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
for (NSIndexPath *path in _selectRowArr) { for (NSIndexPath *path in _selectRowArr) {
if (path.row == indexPath.row) { if (path.row == indexPath.row && path.section == indexPath.section) {
return YES; return YES;
} }
} }
......
...@@ -67,11 +67,11 @@ ...@@ -67,11 +67,11 @@
if (i == 0) { if (i == 0) {
view.backgroundColor = [UIColor redColor]; view.backgroundColor = [UIColor redColor];
self.productVC.viewFrame = view.bounds; self.productVC.viewFrame = CGRectMake(view.bounds.origin.x, view.bounds.origin.y, view.bounds.size.width, view.bounds.size.height - 30);
self.productVC.isHiddenEdit = self.isHiddenEdit; self.productVC.isHiddenEdit = self.isHiddenEdit;
[view addSubview:self.productVC.view]; [view addSubview:self.productVC.view];
}else if(i == 1){ }else if(i == 1){
self.costVC.viewFrame = view.bounds; self.costVC.viewFrame = CGRectMake(view.bounds.origin.x, view.bounds.origin.y, view.bounds.size.width, view.bounds.size.height - 30);
self.costVC.isHiddenEdit = self.isHiddenEdit; self.costVC.isHiddenEdit = self.isHiddenEdit;
[view addSubview:self.costVC.view]; [view addSubview:self.costVC.view];
view.backgroundColor = [UIColor blueColor]; view.backgroundColor = [UIColor blueColor];
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
{ {
if (self.productVC.transportProductArr) { if (self.productVC.transportProductArr) {
[self.productVC.transportProductArr addObject:transportPdtDetail]; [self.productVC.transportProductArr addObject:transportPdtDetail];
[self.productVC.tableView reloadData]; [self.productVC refresh];
} }
} }
//添加编辑 //添加编辑
...@@ -166,21 +166,21 @@ ...@@ -166,21 +166,21 @@
[productArr addObject:billProbuct]; [productArr addObject:billProbuct];
} }
self.productVC.transportProductArr = productArr; self.productVC.transportProductArr = productArr;
[self.productVC.tableView reloadData]; [self.productVC refresh];
} }
- (void)reProduct:(NSArray *)tranProductArr{ - (void)reProduct:(NSArray *)tranProductArr{
[self.productVC.transportProductArr addObjectsFromArray:tranProductArr]; [self.productVC.transportProductArr addObjectsFromArray:tranProductArr];
[self.productVC.tableView reloadData]; [self.productVC refresh];
} }
- (void)refreshDelProduct:(TransportPdtDetail *)fee tag:(NSInteger)indexTag{ - (void)refreshDelProduct:(TransportPdtDetail *)fee tag:(NSInteger)indexTag{
if (fee) { if (fee) {
[self.productVC.transportProductArr removeObjectAtIndex:indexTag]; [self.productVC.transportProductArr removeObjectAtIndex:indexTag];
[self.productVC.tableView reloadData]; [self.productVC refresh];
} }
} }
- (void)refreshEditProduct:(TransportPdtDetail *)transportPdtDetail tag:(NSInteger)indexTag{ - (void)refreshEditProduct:(TransportPdtDetail *)transportPdtDetail tag:(NSInteger)indexTag{
[self.productVC.transportProductArr replaceObjectAtIndex:indexTag withObject:transportPdtDetail]; [self.productVC.transportProductArr replaceObjectAtIndex:indexTag withObject:transportPdtDetail];
[self.productVC.tableView reloadData]; [self.productVC refresh];
} }
@end @end
...@@ -179,9 +179,9 @@ ...@@ -179,9 +179,9 @@
- (void)setPdtDetail:(TransportPdtDetail *)pdtDetail row:(NSInteger)row{ - (void)setPdtDetail:(TransportPdtDetail *)pdtDetail row:(NSInteger)row{
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)]; self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = pdtDetail.productName; self.titleLabel.text = pdtDetail.productName;
self.qpcLabel.text = [NSString stringWithFormat:@"%.1f元",[pdtDetail.qpc floatValue]]; // self.qpcLabel.text = [NSString stringWithFormat:@"%.1f元",[pdtDetail.qpc floatValue]];
self.countLabel.text = [NSString stringWithFormat:@"%@%@",[pdtDetail.qty stringValue],pdtDetail.unit]; self.countLabel.text = [NSString stringWithFormat:@"%@%@",[pdtDetail.qty stringValue],pdtDetail.unit];
self.shippedQtyLabel.text = [NSString stringWithFormat:@"%@",pdtDetail.baseQty != nil && ![pdtDetail.baseQty isKindOfClass:[NSNull class]]? [pdtDetail.baseQty stringValue]:@"0"]; self.shippedQtyLabel.text = @"0";
self.showNameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",pdtDetail.productName,pdtDetail.productCode]; self.showNameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",pdtDetail.productName,pdtDetail.productCode];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",[pdtDetail.qpc stringValue],pdtDetail.baseUnit]; self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",[pdtDetail.qpc stringValue],pdtDetail.baseUnit];
......
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