Skip to content

Commit

Permalink
增加一品多码
Browse files Browse the repository at this point in the history
  • Loading branch information
woaomo committed Sep 13, 2015
1 parent 54bcf34 commit 54ed09d
Show file tree
Hide file tree
Showing 13 changed files with 401 additions and 3 deletions.
12 changes: 12 additions & 0 deletions YHB_Prj/YHB_Prj.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
AB42ACD91B8BE303001FB93A /* GateTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = AB42ACD71B8BE303001FB93A /* GateTableViewCell.m */; };
AB42ACDA1B8BE303001FB93A /* GateTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB42ACD81B8BE303001FB93A /* GateTableViewCell.xib */; };
AB42ACDD1B8BE97E001FB93A /* GateHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = AB42ACDC1B8BE97E001FB93A /* GateHeaderView.m */; };
AB7603C61BA5117C004A5F31 /* YPDMViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB7603C51BA5117C004A5F31 /* YPDMViewController.m */; };
AB7603C91BA51CC5004A5F31 /* YPDMTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = AB7603C81BA51CC5004A5F31 /* YPDMTableViewCell.m */; };
AB79DB591B93FF6000CC1894 /* ChooseBtn.m in Sources */ = {isa = PBXBuildFile; fileRef = AB79DB581B93FF6000CC1894 /* ChooseBtn.m */; };
AB8071C21B96C5CD002114C9 /* EmpMode.m in Sources */ = {isa = PBXBuildFile; fileRef = AB8071C11B96C5CD002114C9 /* EmpMode.m */; };
AB8071C51B96C7AA002114C9 /* EmpManage.m in Sources */ = {isa = PBXBuildFile; fileRef = AB8071C41B96C7AA002114C9 /* EmpManage.m */; };
Expand Down Expand Up @@ -402,6 +404,10 @@
AB42ACD81B8BE303001FB93A /* GateTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GateTableViewCell.xib; sourceTree = "<group>"; };
AB42ACDB1B8BE97E001FB93A /* GateHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GateHeaderView.h; sourceTree = "<group>"; };
AB42ACDC1B8BE97E001FB93A /* GateHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GateHeaderView.m; sourceTree = "<group>"; };
AB7603C41BA5117C004A5F31 /* YPDMViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YPDMViewController.h; sourceTree = "<group>"; };
AB7603C51BA5117C004A5F31 /* YPDMViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YPDMViewController.m; sourceTree = "<group>"; };
AB7603C71BA51CC5004A5F31 /* YPDMTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YPDMTableViewCell.h; sourceTree = "<group>"; };
AB7603C81BA51CC5004A5F31 /* YPDMTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YPDMTableViewCell.m; sourceTree = "<group>"; };
AB79DB571B93FF6000CC1894 /* ChooseBtn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseBtn.h; sourceTree = "<group>"; };
AB79DB581B93FF6000CC1894 /* ChooseBtn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseBtn.m; sourceTree = "<group>"; };
AB8071C01B96C5CD002114C9 /* EmpMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmpMode.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1214,6 +1220,10 @@
ABDDB37F1BA3C2E300DCD659 /* XSLSTableViewCell.xib */,
ABDDB3881BA421B200DCD659 /* XSLSMode.h */,
ABDDB3891BA421B200DCD659 /* XSLSMode.m */,
AB7603C41BA5117C004A5F31 /* YPDMViewController.h */,
AB7603C51BA5117C004A5F31 /* YPDMViewController.m */,
AB7603C71BA51CC5004A5F31 /* YPDMTableViewCell.h */,
AB7603C81BA51CC5004A5F31 /* YPDMTableViewCell.m */,
);
path = EditSPVC;
sourceTree = "<group>";
Expand Down Expand Up @@ -2072,11 +2082,13 @@
FF4DFCF51B856B9600617660 /* SCach.m in Sources */,
FF4DFCF41B856B9600617660 /* NSFileManager_Additions.m in Sources */,
ABAACA071B95B5EC00305080 /* SupplierManage.m in Sources */,
AB7603C91BA51CC5004A5F31 /* YPDMTableViewCell.m in Sources */,
FF012FA91B8EB92C00AE563C /* VipInfoMode.m in Sources */,
FFF391991B846F58007DC652 /* AFURLConnectionOperation.m in Sources */,
FF012FB51B8EB92C00AE563C /* HYCell.m in Sources */,
FF2A6C961A0F3D06001607AC /* SecondViewController.m in Sources */,
5B54BA241B9225FD002098A4 /* DJCheckCartEngine.m in Sources */,
AB7603C61BA5117C004A5F31 /* YPDMViewController.m in Sources */,
AB42ACD91B8BE303001FB93A /* GateTableViewCell.m in Sources */,
FF3C20041A2EE7480081D3C7 /* FactoryModel.m in Sources */,
AB2579341B8F02010015039A /* IQNSArray+Sort.m in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions YHB_Prj/YHB_Prj/Images.xcassets/sp_jia.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "sp_jia.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions YHB_Prj/YHB_Prj/Images.xcassets/sp_jian.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "sp_jian.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ - (void)createScrollView
_titleArray = @[@"条码:",@"品名:",@"分类:",@"库存:",@"进价:",@"售价:",@"单位:",@"供货商:",@"折扣活动:",@"积分商品:"];
NSString *isAct = [_myMode.strActEnable intValue]==1?@"参加":@"不参加";
NSString *isScore = [_myMode.strIsScore intValue]==1?@"":@"";
_contentArray = @[_myMode.strProductCode,_myMode.strProductName,_myMode.strClsName,_myMode.strStockQty,_myMode.strBuyingPrice,_myMode.strSalePrice,_myMode.strSaleUnit,@"",isAct,isScore];
_contentArray = @[_myMode.strProductCode,_myMode.strProductName,_myMode.strClsName,_myMode.strStockQty,_myMode.strBuyingPrice,_myMode.strSalePrice,_myMode.strSaleUnit,_myMode.strSupName,isAct,isScore];

CGFloat endHeight = 0;
for (int i=0; i<_titleArray.count; i++)
Expand Down
18 changes: 18 additions & 0 deletions YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/YPDMTableViewCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// YPDMTableViewCell.h
// YHB_Prj
//
// Created by Johnny's on 15/9/13.
// Copyright (c) 2015年 striveliu. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface YPDMTableViewCell : UITableViewCell

@property(nonatomic) int row;

+ (CGFloat)heightForCell:(NSString *)str;
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier;
- (void)setCellWithString:(NSString *)str andDeleteBlock:(void(^)(int))aDeleteBlock;
@end
101 changes: 101 additions & 0 deletions YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/YPDMTableViewCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
//
// YPDMTableViewCell.m
// YHB_Prj
//
// Created by Johnny's on 15/9/13.
// Copyright (c) 2015年 striveliu. All rights reserved.
//

#import "YPDMTableViewCell.h"

@interface YPDMTableViewCell()
{
CGRect _laFrame;
}
@property(nonatomic,strong) UILabel *laMa;
@property(nonatomic,strong) UIButton *btnJian;
@property(nonatomic,strong) void(^ myBlock)(int);
@end

@implementation YPDMTableViewCell

- (void)awakeFromNib {
// Initialization code
}

+ (CGFloat)heightForCell:(NSString *)str
{
NSDictionary *strAttrbute = @{NSFontAttributeName:kFont12};
CGSize strSize = [str boundingRectWithSize:CGSizeMake(kMainScreenWidth-50, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:strAttrbute context:nil].size;
MLOG(@"%@", NSStringFromCGSize(strSize));
return strSize.height+12;
}

- (CGSize)jisuangaodu:(NSString *)str
{
NSDictionary *strAttrbute = @{NSFontAttributeName:kFont12};
CGSize strSize = [str boundingRectWithSize:CGSizeMake(kMainScreenWidth-50, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:strAttrbute context:nil].size;
return strSize;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
{

}
return self;
}

- (void)setCellWithString:(NSString *)str andDeleteBlock:(void (^)(int))aDeleteBlock
{
[self resetCell];

_myBlock = aDeleteBlock;

self.selectionStyle = UITableViewCellSelectionStyleNone;

CGSize strSize = [self jisuangaodu:str];
_laMa = [[UILabel alloc] initWithFrame:CGRectMake(15, 6, strSize.width, strSize.height)];
_laMa.font = kFont12;
_laMa.numberOfLines = 0;
_laMa.text = str;
[self addSubview:_laMa];

UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, strSize.height+12-0.7, kMainScreenWidth, 0.5)];
lineView.backgroundColor = RGBCOLOR(220, 220, 220);
[self addSubview:lineView];

UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(kMainScreenWidth-30, strSize.height/2.0+6-10, 20, 20)];
[btn setImage:[UIImage imageNamed:@"sp_jian"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(touchBtn) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btn];
}

- (void)resetCell
{
_myBlock = nil;
[self removeSubviews:self];
}

- (void)touchBtn
{
_myBlock(_row);
}

- (void)removeSubviews:(UIView *)aView
{
while (aView.subviews.count)
{
UIView* child = aView.subviews.lastObject;
[child removeFromSuperview];
}
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];

// Configure the view for the selected state
}

@end
15 changes: 15 additions & 0 deletions YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/YPDMViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// YPDMViewController.h
// YHB_Prj
//
// Created by Johnny's on 15/9/13.
// Copyright (c) 2015年 striveliu. All rights reserved.
//

#import "BaseViewController.h"
@class SPGLProductMode;
@interface YPDMViewController : BaseViewController

- (instancetype)initWithProductMode:(SPGLProductMode *)aMode ;

@end
Loading

0 comments on commit 54ed09d

Please sign in to comment.