| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535 |
- //
- // OtherInStorageGoodsListCell.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/4/25.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "OtherInStorageGoodsListCell.h"
- @implementation OtherInStorageGoodsListCell
- #pragma mark 公共函数
- /**
- 加载 tableview cell
- @param style <#style description#>
- @param reuseIdentifier <#reuseIdentifier description#>
- @return <#return value description#>
- */
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
-
- return self;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- }
- #pragma mark 委托函数
- /**
- textField失去焦点回调函数
- */
- - (void) textFieldDidEndEditing:(UITextField *) field
- {
- if(field.tag==1001){
- _inStorageGoodsListModel.enterPrice=field.text;
- if ([ _inStorageGoodsListModel.enterPrice doubleValue] >MAXIMUM_PRICE) {
- _inStorageGoodsListModel.enterPrice =[NSString stringWithFormat:@"%lf",MAXIMUM_PRICE];
-
- }
- }
- if(field.tag==1002){
- NSString *enterQuantity=field.text;
- if(enterQuantity!=nil){
- double enterQuantityValue=enterQuantity.doubleValue;
- NSInteger circulateType= _inStorageGoodsListModel.circulateType;
- NSString *quantity= [NSString stringWithFormat:@"%lf",enterQuantityValue];
-
- double acreage=[_inStorageGoodsListModel.acreage doubleValue];
- OrderQuantity *orderQuantity=[OrderQuantity new];
- int decimalPlaces= [_inStorageGoodsListModel.decimalPlaces intValue];
- NSString *calculateQuantity= [orderQuantity calculateOrderQuantity:circulateType decimalPlaces:[NSString stringWithFormat:@"%ld",(long)decimalPlaces] quantity:quantity acreage:acreage];
-
- _inStorageGoodsListModel.enterQuantity=calculateQuantity;
- field.text=calculateQuantity;
- }
- else{
- _inStorageGoodsListModel.enterQuantity=@"0";
- field.text=@"0";
- }
-
- }
-
-
- if(field.tag==1003){
- _inStorageGoodsListModel.colorNumber=field.text;
- }
-
- if([self.inStorageDelegate respondsToSelector:@selector(refreshTable)])
- {
- [self.inStorageDelegate refreshTable];
-
- }
-
- }
- - (void) textFieldDidChange:(UITextField *)textField
- {
- NSInteger kMaxLength =17;
- NSString *toBeString = textField.text;
- NSString *lang = [[UIApplication sharedApplication]textInputMode].primaryLanguage; //ios7之前使用[UITextInputMode currentInputMode].primaryLanguage
- if ([lang isEqualToString:@"zh-Hans"]) { //中文输入
- UITextRange *selectedRange = [textField markedTextRange];
- //获取高亮部分
- UITextPosition *position = [textField positionFromPosition:selectedRange.start offset:0];
- if (!position) {// 没有高亮选择的字,则对已输入的文字进行字数统计和限制
- if (toBeString.length > kMaxLength) {
- textField.text = [toBeString substringToIndex:kMaxLength];
- }
- }
- else{//有高亮选择的字符串,则暂不对文字进行统计和限制
- }
- }else{//中文输入法以外的直接对其统计限制即可,不考虑其他语种情况
- if (toBeString.length > kMaxLength) {
- textField.text = [toBeString substringToIndex:kMaxLength];
- }
- }
- }
- /**
- 初始化其它入库 tableview cell
- @param goodsListModel <#goodsListModel description#>
- */
- -(void)setOtherInStorageGoodsModel:(OtherInStorageGoodsSearchListModel*) goodsListModel{
- _inStorageGoodsListModel=goodsListModel;
- if( _inStorageGoodsListModel==nil){
- return;
- }
-
- CGFloat heightLine = 1;
- CGFloat heightRow = 40;
- CGFloat lblx = 20;
- CGFloat lbly = 8;
- CGFloat lblwidth = 70;
- CGFloat lblheight = 25;
- CGFloat valuey = 8;
- CGFloat valueheight = 25;
- UIView *vGoodsName = [UIView new];
- vGoodsName.frame=CGRectMake(0,0, Screen_Width, heightRow);
- [self.contentView addSubview:vGoodsName];
- _lblGoodsName=[[UILabel alloc]init];
- _lblGoodsName.frame=CGRectMake(lblx, lbly,Screen_Width-85, valueheight);
- _lblGoodsName.text=_inStorageGoodsListModel.goodsName;
- _lblGoodsName.font=orderTextFont;
- [self.contentView addSubview:_lblGoodsName];
- _btnDelete=[UIButton buttonWithType:UIButtonTypeCustom];
-
- _btnDelete.frame=CGRectMake(Screen_Width-80,lbly,80, 25);
- [vGoodsName addSubview:_btnDelete];
- [_btnDelete addTarget:self action:@selector(deleteGoods) forControlEvents:UIControlEventTouchUpInside];
- UIImageView *deleteImg=[[UIImageView alloc]init];
- deleteImg.frame=CGRectMake(0,5,15,15);
- [deleteImg setImage:[UIImage imageNamed:@"icon_delete"]];
- deleteImg.userInteractionEnabled=NO;
- [_btnDelete addSubview:deleteImg];
- UILabel *deleteTitle=[[UILabel alloc]init];
- deleteTitle.frame=CGRectMake(CGRectGetMaxX(deleteImg.frame)+3,0,40, 25);
- deleteTitle.text=@"删除";
- deleteTitle.font=orderTextFont;
- [_btnDelete addSubview:deleteTitle];
-
- //分割线
- _topSeparator= [UIView new];
- _topSeparator.frame = CGRectMake(0, CGRectGetMaxY(vGoodsName.frame), Screen_Width, heightLine);
-
- [self.contentView addSubview:_topSeparator];
- UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
- [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
- btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
- [_topSeparator addSubview:btnLine];
-
-
- //商品编码
- UIView *vGoodsCode = [UIView new];
- vGoodsCode.frame=CGRectMake(0, CGRectGetMaxY(_topSeparator.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vGoodsCode];
- UILabel *lblGoodsCodeTitle=[UILabel new];
- lblGoodsCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblGoodsCodeTitle.text=@"商品编码:";
- lblGoodsCodeTitle.textColor = [UIColor blackColor];
- lblGoodsCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsCode addSubview:lblGoodsCodeTitle];
- _lblGoodsCode = [UILabel new];
- _lblGoodsCode.frame=CGRectMake(CGRectGetMaxX(lblGoodsCodeTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblGoodsCodeTitle.frame), valueheight);
- _lblGoodsCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsCode addSubview:_lblGoodsCode];
- _lblGoodsCode.text = _inStorageGoodsListModel.code;
- //
- //唯一编码
- UIView *vOnlyCode = [UIView new];
- vOnlyCode.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_topSeparator.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vOnlyCode];
- UILabel *lblOnlyCodeTitle=[UILabel new];
- lblOnlyCodeTitle.frame=CGRectMake(0, lbly, lblwidth, lblheight);
- lblOnlyCodeTitle.text=@"唯一编码:";
- lblOnlyCodeTitle.textColor = [UIColor blackColor];
- lblOnlyCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:lblOnlyCodeTitle];
- _lblOnlyCode= [UILabel new];
- _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:_lblOnlyCode];
- _lblOnlyCode.text = _inStorageGoodsListModel.onlyCode;
- UIView *vSpecification= [UIView new];
- vSpecification.frame=CGRectMake(lblx, CGRectGetMaxY(vGoodsCode.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vSpecification];
- UILabel *lblSpecificationTitle=[UILabel new];
- lblSpecificationTitle.frame=CGRectMake(0, lbly, lblwidth, lblheight);
- lblSpecificationTitle.text=@"规 格:";
- lblSpecificationTitle.textColor = [UIColor blackColor];
- lblSpecificationTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:lblSpecificationTitle];
- _lblSpecification = [UILabel new];
- _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblSpecificationTitle.frame), valuey, vSpecification.frame.size.width -lblwidth, valueheight);
- _lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:_lblSpecification];
- _lblSpecification.text = _inStorageGoodsListModel.specification;
- UIView *vGrade= [UIView new];
- vGrade.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(vGoodsCode.frame),Screen_Width/2, heightRow);
- [self.contentView addSubview:vGrade];
- UILabel *lblGradeTitle=[UILabel new];
- lblGradeTitle.frame=CGRectMake(0, lbly, lblwidth, lblheight);
- lblGradeTitle.text=@"等 级:";
- lblGradeTitle.textColor = [UIColor blackColor];
- lblGradeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGrade addSubview:lblGradeTitle];
- _lblGrade = [UILabel new];
- _lblGrade.userInteractionEnabled=YES;
- _lblGrade.frame=CGRectMake(CGRectGetMaxX(lblGradeTitle.frame), lbly,vGrade.frame.size.width-lblwidth-5, valueheight);
- _lblGrade.text=@"请选择等级";
- UITapGestureRecognizer *tapRecognizerGrade=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goGrade:)];
- [_lblGrade addGestureRecognizer:tapRecognizerGrade];
- _lblGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGrade addSubview:_lblGrade];
- if( _inStorageGoodsListModel.gradeName!=nil&&_inStorageGoodsListModel.gradeName.length>0){
- _lblGrade.text = _inStorageGoodsListModel.gradeName;
- }
- UIView *vColorNumber= [UIView new];
- vColorNumber.frame=CGRectMake(0, CGRectGetMaxY(vSpecification.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview: vColorNumber];
- UILabel *lblColorNumberTitle=[UILabel new];
- lblColorNumberTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblColorNumberTitle.text=@"色 号:";
- lblColorNumberTitle.textColor = [UIColor blackColor];
- lblColorNumberTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vColorNumber addSubview:lblColorNumberTitle];
- _txtColorNumber= [UITextField new];
- _txtColorNumber.frame=CGRectMake(CGRectGetMaxX(lblColorNumberTitle.frame), valuey, vColorNumber.frame.size.width-lblwidth-5 , valueheight);
- _txtColorNumber.placeholder=@"请输入色号";
- _txtColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _txtColorNumber.tag=1003;
- _txtColorNumber.delegate=self;
- [vColorNumber addSubview:_txtColorNumber];
- _txtColorNumber.text = _inStorageGoodsListModel.colorNumber;
- UIView *vBrand= [UIView new];
- vBrand.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(vSpecification.frame),Screen_Width/2, heightRow);
- [self.contentView addSubview:vBrand];
- UILabel *lblBrandTitle=[UILabel new];
- lblBrandTitle.frame=CGRectMake(0, lbly, lblwidth, lblheight);
- lblBrandTitle.text=@"品 牌:";
- lblBrandTitle.textColor = [UIColor blackColor];
- lblBrandTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vBrand addSubview:lblBrandTitle];
- _lblBrand = [UILabel new];
- _lblBrand.frame=CGRectMake(CGRectGetMaxX(lblBrandTitle.frame), lbly,vBrand.frame.size.width-lblwidth-5, valueheight);
- _lblBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vBrand addSubview:_lblBrand];
- _lblBrand.text = _inStorageGoodsListModel.brandName;
- UIView *vWarehouse= [UIView new];
- vWarehouse.frame=CGRectMake(0, CGRectGetMaxY(vColorNumber.frame), Screen_Width, heightRow);
- [self.contentView addSubview: vWarehouse];
- UILabel *lblWarehouseTitle=[UILabel new];
- lblWarehouseTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblWarehouseTitle.text=@"库 区:";
- lblWarehouseTitle.textColor = [UIColor blackColor];
- lblWarehouseTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vWarehouse addSubview:lblWarehouseTitle];
- _lblWarehouse= [UILabel new];
- _lblWarehouse.frame=CGRectMake(CGRectGetMaxX(lblWarehouseTitle.frame), valuey, vWarehouse.frame.size.width-lblwidth-lblx-5 , valueheight);
- _lblWarehouse.userInteractionEnabled=YES;
- _lblWarehouse.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vWarehouse addSubview:_lblWarehouse];
- _lblWarehouse.text=@"请选择库区";
- UITapGestureRecognizer *tapRecognizerWarehouse=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goWarehouse:)];
- [_lblWarehouse addGestureRecognizer:tapRecognizerWarehouse];
- if(_inStorageGoodsListModel.warehouseName!=nil&&_inStorageGoodsListModel.warehouseName.length>0){
- _lblWarehouse.text = _inStorageGoodsListModel.warehouseName;
- }
-
- UIView *vPositionNumber= [UIView new];
- vPositionNumber.frame=CGRectMake(0, CGRectGetMaxY(vWarehouse.frame), Screen_Width, heightRow);
- [self.contentView addSubview: vPositionNumber];
-
- UILabel *lblPositionNumberTitle=[UILabel new];
- lblPositionNumberTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblPositionNumberTitle.text=@"仓 位 号:";
- lblPositionNumberTitle.textColor = [UIColor blackColor];
- lblPositionNumberTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vPositionNumber addSubview:lblPositionNumberTitle];
-
- _lblPostionNumber= [UILabel new];
- _lblPostionNumber.frame=CGRectMake(CGRectGetMaxX(lblPositionNumberTitle.frame), valuey, vPositionNumber.frame.size.width-lblwidth-lblx-5 , valueheight);
- _lblPostionNumber.userInteractionEnabled=YES;
- _lblPostionNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vPositionNumber addSubview:_lblPostionNumber];
- _lblPostionNumber.text=@"请选择仓位号";
- UITapGestureRecognizer *tapRecognizerPositionNumber=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goPositionNumber:)];
- [_lblPostionNumber addGestureRecognizer:tapRecognizerPositionNumber];
- if(_inStorageGoodsListModel.positionNumberName!=nil&&_inStorageGoodsListModel.positionNumberName.length>0){
- _lblPostionNumber.text = _inStorageGoodsListModel.positionNumberName;
- }
- //分割线
- _middleSeparator= [UIView new];
- _middleSeparator.frame = CGRectMake(0, CGRectGetMaxY(vPositionNumber.frame), Screen_Width, heightLine);
- [_middleSeparator setBackgroundColor:LineBackgroundColor];
- [self.contentView addSubview:_middleSeparator];
- // NSDictionary *inStorageDict = @{NSFontAttributeName:orderTextFont};
- // UIView *vQuantity = [UIView new];
- // vQuantity.frame=CGRectMake(0, CGRectGetMaxY(_middleSeparator.frame), Screen_Width, heightRow);
- // [self.contentView addSubview:vQuantity];
- // _lblInventoryQuantity=[UILabel new];
- //
- // NSString *inventoryQuantity= _inStorageGoodsListModel.inventoryQuantity;
- // inventoryQuantity= [NSString stringWithFormat:@"%@%@",@"结存量:",inventoryQuantity];
- // CGRect inventoryQuantityFrame = [inventoryQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:inStorageDict];
- // inventoryQuantityFrame.origin.x =Screen_Width-inventoryQuantityFrame.size.width-10;
- // inventoryQuantityFrame.origin.y = valuey;
- //
- // _lblInventoryQuantity.frame=inventoryQuantityFrame;
- // _lblInventoryQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- // _lblInventoryQuantity.textColor = [UIColor redColor];
- // _lblInventoryQuantity.text=inventoryQuantity;
- // [vQuantity addSubview:_lblInventoryQuantity];
- //
- // _lblCanSalesQuantity=[UILabel new];
- // NSString *canSalesQuantity=_inStorageGoodsListModel.canSalesQuantity;
- // canSalesQuantity=[NSString stringWithFormat:@"%@%@",@"可售量",canSalesQuantity];
- // CGRect canSalesQuantityFrame = [canSalesQuantity textRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) attributes:inStorageDict];
- // canSalesQuantityFrame.origin.x =Screen_Width-inventoryQuantityFrame.size.width-canSalesQuantityFrame.size.width-10-5;
- // canSalesQuantityFrame.origin.y = valuey;
- //
- // _lblCanSalesQuantity.frame=canSalesQuantityFrame;
- // _lblCanSalesQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- // _lblCanSalesQuantity.textColor = [UIColor redColor];
- // _lblCanSalesQuantity.text=canSalesQuantity;
- // [vQuantity addSubview:_lblCanSalesQuantity];
- UIView *salesPriceView=[[UIView alloc]init];
- salesPriceView.layer.borderWidth=0.5f;
- salesPriceView.layer.borderColor=[UIColor blackColor].CGColor;
- salesPriceView.frame=CGRectMake(Screen_Width-280, CGRectGetMaxY(_middleSeparator.frame)+5, 115,25 );;
- [self.contentView addSubview: salesPriceView];
- UILabel *lblSymbol=[[UILabel alloc]init];
- lblSymbol.text=@"¥";
- lblSymbol.textColor=LabelGrayTextColor;
- lblSymbol.frame=CGRectMake(5,5,15,15);
- lblSymbol.font=orderTextFont;
- lblSymbol.textAlignment=NSTextAlignmentCenter;
- [salesPriceView addSubview:lblSymbol];
- _txtEnterPrice=[UITextField new];
- _txtEnterPrice.frame=CGRectMake(CGRectGetMaxX(lblSymbol.frame)+5, 0, 90, 25);
- _txtEnterPrice.userInteractionEnabled=YES;
- _txtEnterPrice.delegate=self;
- _txtEnterPrice.keyboardType=UIKeyboardTypeDecimalPad;
- _txtEnterPrice.tag=1001;
- _txtEnterPrice.text=_inStorageGoodsListModel.enterPrice;
- _txtEnterPrice.textAlignment=NSTextAlignmentCenter;
- _txtEnterPrice.font=orderTextFont;
- [_txtEnterPrice addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- [salesPriceView addSubview:_txtEnterPrice];
- UIButton *substractButton=[UIButton buttonWithType:UIButtonTypeCustom];
- [substractButton setTitle:@"-" forState:UIControlStateNormal];
- [substractButton setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
- substractButton.frame=CGRectMake(CGRectGetMaxX(salesPriceView.frame)+10,CGRectGetMaxY(_middleSeparator.frame)+5,25,25);;
- substractButton.layer.borderColor=[UIColor blackColor].CGColor;
- substractButton.layer.borderWidth=0.5f;
- [substractButton addTarget:self action:@selector(substractQuantity) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:substractButton];
- _txtEnterQuantity=[UITextField new];
- _txtEnterQuantity.frame=CGRectMake(CGRectGetMaxX(substractButton.frame)-1,CGRectGetMaxY(_middleSeparator.frame)+5,100,25);;
- _txtEnterQuantity.delegate=self;
- _txtEnterQuantity.keyboardType=UIKeyboardTypeDecimalPad;
- _txtEnterQuantity.layer.borderWidth=0.5f;
- _txtEnterQuantity.tag=1002;
- [_txtEnterQuantity addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- _txtEnterQuantity.text=_inStorageGoodsListModel.enterQuantity;
- _txtEnterQuantity.textAlignment=NSTextAlignmentCenter;
- _txtEnterQuantity.layer.borderColor=[UIColor blackColor].CGColor;
- _txtEnterQuantity.font=orderTextFont;
- [self.contentView addSubview:_txtEnterQuantity];
- UIButton *addButton=[UIButton buttonWithType:UIButtonTypeCustom];
- [addButton setTitle:@"+" forState:UIControlStateNormal];
- [addButton setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
- addButton.frame=CGRectMake(CGRectGetMaxX(_txtEnterQuantity.frame)-1,CGRectGetMaxY(_middleSeparator.frame)+5,25,25);
- addButton.layer.borderColor=[UIColor blackColor].CGColor;
- addButton.layer.borderWidth=0.5;
- [addButton addTarget:self action:@selector(addQuantity) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:addButton];
-
- //分割线
- _bottomSeparator= [UIView new];
- _bottomSeparator.frame = CGRectMake(0, CGRectGetMaxY(salesPriceView.frame)+5, Screen_Width, 10);
- [_bottomSeparator setBackgroundColor:LineBackgroundColor];
- [self.contentView addSubview:_bottomSeparator];
-
-
- }
- /**
- 跳转到等级页面
- @param gesture <#gesture description#>
- */
- -(void)goGrade:(UITapGestureRecognizer *)gesture{
- if([self.inStorageDelegate respondsToSelector:@selector(goGrade:) ]){
- [self.inStorageDelegate goGrade:_index];
- }
- }
- /**
- 跳转到库区页面
- @param gesture <#gesture description#>
- */
- -(void)goWarehouse:(UITapGestureRecognizer *)gesture{
- if([self.inStorageDelegate respondsToSelector:@selector(goWareHouse:) ]){
- [self.inStorageDelegate goWareHouse:_index];
- }
- }
- /**
- 跳转到仓位号页面
- @param gesture <#gesture description#>
- */
- -(void)goPositionNumber:(UITapGestureRecognizer *)gesture{
- if([self.inStorageDelegate respondsToSelector:@selector(goPositionNumber:) ]){
- [self.inStorageDelegate goPositionNumber:_index];
- }
- }
- /**
- 增加数量
- */
- -(void)addQuantity{
- NSString *enterQuantity=_txtEnterQuantity.text;
- if(enterQuantity!=nil){
- double quantityValue=enterQuantity.doubleValue;
- NSInteger circulateType= _inStorageGoodsListModel.circulateType;
- if(circulateType==2){
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
-
- UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"标题" message:@"请手动输入商品数量" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
- [ alert show];
- #pragma clang diagnostic pop
- return;
- }
- ++quantityValue;
- NSString *quantity= [NSString stringWithFormat:@"%lf",quantityValue];
- double acreage=[_inStorageGoodsListModel.acreage doubleValue];
- OrderQuantity *orderQuantity=[OrderQuantity new];
- int decimalPlaces= [_inStorageGoodsListModel.decimalPlaces intValue];
- NSString *calculateQuantity= [orderQuantity calculateOrderQuantity:circulateType decimalPlaces:[NSString stringWithFormat:@"%ld",(long)decimalPlaces] quantity:quantity acreage:acreage];
-
- _inStorageGoodsListModel.enterQuantity=calculateQuantity;
- _txtEnterQuantity.text=calculateQuantity;
- }
- else{
- _inStorageGoodsListModel.enterQuantity=@"0";
- _txtEnterQuantity.text=@"0";
- }
-
- if([self.inStorageDelegate respondsToSelector:@selector(refreshTable)])
- {
- [self.inStorageDelegate refreshTable];
-
- }
-
-
- }
- /**
- 减少数量
- */
- -(void)substractQuantity{
- NSString *enterQuantity=_txtEnterQuantity.text;
- if(enterQuantity!=nil){
- double quantityValue=enterQuantity.doubleValue;
- NSInteger circulateType= _inStorageGoodsListModel.circulateType;
- if(circulateType==2){
- UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"标题" message:@"请手动输入商品数量" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
- [ alert show];
- return;
- }
- --quantityValue;
- if(quantityValue<0){
- quantityValue=0;
- }
- NSString *quantity= [NSString stringWithFormat:@"%lld",(long long)quantityValue];
- double acreage=[_inStorageGoodsListModel.acreage doubleValue];
- OrderQuantity *orderQuantity=[OrderQuantity new];
- int decimalPlaces= [_inStorageGoodsListModel.decimalPlaces intValue];
- NSString *calculateQuantity= [orderQuantity calculateOrderQuantity:circulateType decimalPlaces:[NSString stringWithFormat:@"%ld",(long)decimalPlaces] quantity:quantity acreage:acreage];
- _txtEnterQuantity.text=calculateQuantity;
- _inStorageGoodsListModel.enterQuantity=calculateQuantity;
- }
- if([self.inStorageDelegate respondsToSelector:@selector(refreshTable)])
- {
- [self.inStorageDelegate refreshTable];
-
- }
-
- }
- /**
- 删除商品
- */
- -(void)deleteGoods{
- if([self.inStorageDelegate respondsToSelector:@selector(deleteGoods:)])
- {
- [self.inStorageDelegate deleteGoods:_index];
-
- }
- }
- @end
|