| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528 |
- //
- // NewSalesGoodsDetailCell.m
- // IBOSSmini
- //
- // Created by ssl on 2018/2/27.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "NewSalesGoodsDetailCell.h"
- @implementation NewSalesGoodsDetailCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
-
- return self;
- }
- -(void) goUsePosition{
-
- }
- - (void)setInventoryCell:(InventoryModel *)inventoryDetailModel editStatus:(int)flag editFlag:(int)editFlag{
- CGFloat heightLine = 1;
- CGFloat lblx = 20;
- CGFloat valuey = 10;
- CGFloat valueheight = 25;
- _inventoryModel=inventoryDetailModel;
- _editStatus=flag;
- _lblGoodsName = [UILabel new];
- _lblGoodsName.frame=CGRectMake(lblx, valuey, Screen_Width- lblx - 55, valueheight);
- _lblGoodsName.font =orderTextFont;
- [self addSubview:_lblGoodsName];
- _lblGoodsName.text = _inventoryModel.goodsName;
- _vDelete=[UIView new];
- _vDelete.frame=CGRectMake(Screen_Width-65, valuey,70 , valueheight);
-
- UIButton *btnDelete=[UIButton buttonWithType:UIButtonTypeCustom];
- btnDelete.frame=CGRectMake(0, 4,15, 15);
- UIImageView *deleteImg=[[UIImageView alloc]init];
- deleteImg.frame=CGRectMake(0,0,15,15);
- [deleteImg setImage:[UIImage imageNamed:@"icon_delete"]];
- deleteImg.userInteractionEnabled=NO;
- [btnDelete addSubview:deleteImg];
- [_vDelete addSubview:btnDelete];
- _vDelete.userInteractionEnabled=YES;
- UILabel *lblDelete=[UILabel new];
- lblDelete.text=@"删除";
- lblDelete.frame=CGRectMake(CGRectGetMaxX(btnDelete.frame)+3, 0,30, 25);
- lblDelete.font=orderTextFont;
- [_vDelete addSubview:lblDelete];
- [self addSubview:_vDelete];
-
- UITapGestureRecognizer *tapRecognizerDelete=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(deleteOrder)];
- _vDelete.userInteractionEnabled=YES;
- [_vDelete addGestureRecognizer:tapRecognizerDelete];
-
- _topSeparator=[UIView new];
- _topSeparator.frame=CGRectMake(0, CGRectGetMaxY(_vDelete.frame)+valuey, Screen_Width, heightLine);
- [self 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];
-
- UILabel *lblGoodsCodeTitle=[UILabel new];
- lblGoodsCodeTitle.frame=CGRectMake(lblx,CGRectGetMaxY(_topSeparator.frame)+valuey,70, valueheight);
- lblGoodsCodeTitle.text=@"商品编码:";
- lblGoodsCodeTitle.font=orderTextFont;
- lblGoodsCodeTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblGoodsCodeTitle];
- _lblGoodsCode=[UILabel new];
- NSString *goodsCode=_inventoryModel.code;
- if(goodsCode!=nil){
- _lblGoodsCode.frame=CGRectMake(CGRectGetMaxX(lblGoodsCodeTitle.frame), CGRectGetMaxY(_topSeparator.frame)+valuey,Screen_Width/2-CGRectGetMaxX(lblGoodsCodeTitle.frame)-3, valueheight);
- _lblGoodsCode.text=goodsCode;
- _lblGoodsCode.font=orderTextFont;
- [self addSubview:_lblGoodsCode];
- }
- UILabel *lblOnlyCodeTitle=[UILabel new];
- lblOnlyCodeTitle.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(_topSeparator.frame)+valuey,70, valueheight);
- lblOnlyCodeTitle.text=@"唯一编码:";
- lblOnlyCodeTitle.font=orderTextFont;
- lblOnlyCodeTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblOnlyCodeTitle];
- NSString *onlyCode=_inventoryModel.onlyCode;
- if(onlyCode!=nil){
- _lblOnlyCode=[UILabel new];
- _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame),CGRectGetMaxY(_topSeparator.frame)+valuey , Screen_Width/2-lblOnlyCodeTitle.frame.size.width-3, valueheight);
- _lblOnlyCode.text=onlyCode;
- _lblOnlyCode.font=orderTextFont;
- [self addSubview:_lblOnlyCode];
- }
-
- UILabel *lblColorNumberTitle=[UILabel new];
- lblColorNumberTitle.frame=CGRectMake(lblx, CGRectGetMaxY(lblGoodsCodeTitle.frame)+valuey,70, valueheight);
- lblColorNumberTitle.text=@"色 号:";
- lblColorNumberTitle.font=orderTextFont;
- lblColorNumberTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblColorNumberTitle];
- NSString *colorNumber=[_inventoryModel colorNumber];
- if(colorNumber!=nil){
- _lblColorNumber=[UILabel new];
- _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblColorNumberTitle.frame), CGRectGetMaxY(lblGoodsCodeTitle.frame)+valuey,Screen_Width/2-CGRectGetMaxX(lblColorNumberTitle.frame), valueheight);
- _lblColorNumber.font=orderTextFont;
- _lblColorNumber.text=colorNumber;
- [self addSubview:_lblColorNumber];
- }
-
- UILabel *lblSpecificationTitle=[UILabel new];
- lblSpecificationTitle.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(lblGoodsCodeTitle.frame)+valuey,70, valueheight);
- lblSpecificationTitle.text=@"规 格:";
- lblSpecificationTitle.font=orderTextFont;
- lblSpecificationTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblSpecificationTitle];
-
- NSString *specification=_inventoryModel.specification;
- if(specification!=nil){
- _lblSpecification=[UILabel new];
- _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblSpecificationTitle.frame), CGRectGetMaxY(lblGoodsCodeTitle.frame)+valuey, Screen_Width/2-lblSpecificationTitle.frame.size.width-3, valueheight);
- _lblSpecification.text=specification;
- _lblSpecification.font=orderTextFont;
- [self addSubview:_lblSpecification];
- }
-
-
- UILabel *lblWarehouseAreaTitle=[UILabel new];
- lblWarehouseAreaTitle.frame=CGRectMake(lblx, CGRectGetMaxY(lblColorNumberTitle.frame)+valuey,70, valueheight);
- lblWarehouseAreaTitle.text=@"库 区:";
- lblWarehouseAreaTitle.font=orderTextFont;
- lblWarehouseAreaTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblWarehouseAreaTitle];
-
- NSString *warehouseArea=_inventoryModel.wareHouseName;
- if(warehouseArea!=nil){
- _lblWarehouseArea=[UILabel new];
- _lblWarehouseArea.frame=CGRectMake(CGRectGetMaxX(lblWarehouseAreaTitle.frame),CGRectGetMaxY(lblColorNumberTitle.frame)+valuey, Screen_Width-CGRectGetMaxX(lblWarehouseAreaTitle.frame)-3, valueheight);
- _lblWarehouseArea.text=warehouseArea;
- _lblWarehouseArea.font=orderTextFont;
- [self addSubview:_lblWarehouseArea];
- }
-
- UILabel *lblRemarksTitle=[UILabel new];
- lblRemarksTitle.frame=CGRectMake(lblx, CGRectGetMaxY(lblWarehouseAreaTitle.frame)+valuey,70, valueheight);
- lblRemarksTitle.text=@"备 注:";
- lblRemarksTitle.font=orderTextFont;
- lblRemarksTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblRemarksTitle];
- NSString *remarks=_inventoryModel.remarks;
- _txtRemarks=[UITextField new];
- _txtRemarks.placeholder=@"请输入备注";
- _txtRemarks.tag=1003;
- _txtRemarks.delegate=self;
- _txtRemarks.enabled=YES;
- _txtRemarks.text=remarks;
- _txtRemarks.font=orderTextFont;
- _txtRemarks.frame=CGRectMake(CGRectGetMaxX(lblRemarksTitle.frame), CGRectGetMaxY(lblWarehouseAreaTitle.frame)+valuey, Screen_Width-CGRectGetMaxX(lblRemarksTitle.frame)-3, valueheight);
- [self addSubview:_txtRemarks];
- UILabel *lblUsePositionTitle=[UILabel new];
- lblUsePositionTitle.frame=CGRectMake(lblx, CGRectGetMaxY(lblRemarksTitle.frame)+valuey,70, valueheight);
- lblUsePositionTitle.text=@"使用位置:";
- lblUsePositionTitle.font=orderTextFont;
- lblUsePositionTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblUsePositionTitle];
-
-
- _btnUsePosition=[UIButton buttonWithType:UIButtonTypeCustom];
- _btnUsePosition.frame=CGRectMake(CGRectGetMaxX(lblUsePositionTitle.frame), CGRectGetMaxY(lblRemarksTitle.frame)+valuey, Screen_Width/2-CGRectGetMaxX(lblUsePositionTitle.frame)-3, valueheight);
- [_btnUsePosition setTitleColor:LabelGrayTextColor forState:UIControlStateNormal];
- [_btnUsePosition setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
- [_btnUsePosition addTarget:self action:@selector(clickUsePosition) forControlEvents:UIControlEventTouchUpInside];
- _btnUsePosition.userInteractionEnabled=YES;
- NSString *usePosition=_inventoryModel.usePositionName;
- if(usePosition!=nil&&usePosition.length>0){
- [_btnUsePosition setTitle:usePosition forState:UIControlStateNormal];
- }else{
- [_btnUsePosition setTitle:@"请选择使用位置" forState:UIControlStateNormal];
- }
- _btnUsePosition.titleLabel.font=orderTextFont;
- [self addSubview:_btnUsePosition];
-
- UILabel *lblGradeTitle=[UILabel new];
- lblGradeTitle.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(lblRemarksTitle.frame)+valuey,70, valueheight);
- lblGradeTitle.text=@"等 级:";
- lblGradeTitle.font=orderTextFont;
- lblGradeTitle.textColor=LabelGrayTextColor;
- [self addSubview:lblGradeTitle];
- NSString *grade=_inventoryModel.gradeName;
- if(grade!=nil){
- _lblGrade=[UILabel new];
- _lblGrade.frame=CGRectMake(CGRectGetMaxX(lblGradeTitle.frame), CGRectGetMaxY(lblRemarksTitle.frame)+valuey,Screen_Width/2-lblGradeTitle.frame.size.width-3, valueheight);
- _lblGrade.text=grade;
- _lblGrade.font=orderTextFont;
- [self addSubview:_lblGrade];
- }
-
- _middleSeparator=[UIView new];
- _middleSeparator.frame=CGRectMake(0, CGRectGetMaxY(lblUsePositionTitle.frame)+valuey, Screen_Width, 1);
- _middleSeparator.backgroundColor=LineBackgroundColor;
- [self addSubview:_middleSeparator];
- _lblDiscount= [[UILabel alloc] init];
- [self updateFrame];
- [self addSubview:_lblDiscount];
-
- UIView *salesPriceView=[[UIView alloc]init];
- salesPriceView.layer.borderWidth=1.0f;
- salesPriceView.layer.borderColor=[LabelGrayTextColor CGColor];
- salesPriceView.frame=CGRectMake(Screen_Width-300, CGRectGetMaxY(_lblDiscount.frame)+10, 130,25 );
- [self addSubview: salesPriceView];
- UILabel *lblSymbol=[[UILabel alloc]init];
- lblSymbol.text=@"¥";
- lblSymbol.textColor=LabelGrayTextColor;
- lblSymbol.frame=CGRectMake(0,5,15,15);
- lblSymbol.font=orderTextFont;
- lblSymbol.textAlignment=NSTextAlignmentCenter;
- [salesPriceView addSubview:lblSymbol];
- NSString *salesPrice=_inventoryModel.salesPrice;
- _txtSalesPrice=[UITextField new];
- _txtSalesPrice.frame=CGRectMake(CGRectGetMaxX(lblSymbol.frame), 0, 100, 25);
- _txtSalesPrice.text=salesPrice;
- _txtSalesPrice.enabled=YES;
- _txtSalesPrice.delegate=self;
- _txtSalesPrice.keyboardType=UIKeyboardTypeDecimalPad;
- _txtSalesPrice.tag=1001;
- _txtSalesPrice.textAlignment=NSTextAlignmentCenter;
- _txtSalesPrice.font=orderTextFont;
- [salesPriceView addSubview:_txtSalesPrice];
-
- UIImageView *penImg= [[UIImageView alloc]init];
- [penImg setImage:[UIImage imageNamed:@"icon_pen"]];
- penImg.frame=CGRectMake(salesPriceView.frame.size.width-17,5,12,12);
- [salesPriceView addSubview:penImg];
-
- UIButton *substractButton=[UIButton buttonWithType:UIButtonTypeCustom];
- [substractButton setTitle:@"-" forState:UIControlStateNormal];
- [substractButton setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
- substractButton.frame=CGRectMake(CGRectGetMaxX(salesPriceView.frame)+10,CGRectGetMaxY(_lblDiscount.frame)+10,25,25);
- substractButton.layer.borderColor=[LabelGrayTextColor CGColor];
- substractButton.layer.borderWidth=1.0;
- substractButton.userInteractionEnabled=YES;
- [substractButton addTarget:self action:@selector(substractQuantity) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:substractButton];
- _txtSalesQuantity=[UITextField new];
- _txtSalesQuantity.frame=CGRectMake(CGRectGetMaxX(substractButton.frame)-1,CGRectGetMaxY(_lblDiscount.frame)+10,100,25);;
- _txtSalesQuantity.text=_inventoryModel.salesQuantity;
- _txtSalesQuantity.delegate=self;
- _txtSalesQuantity.enabled=YES;
- _txtSalesQuantity.keyboardType=UIKeyboardTypeDecimalPad;
- _txtSalesQuantity.layer.borderWidth=1.0f;
- _txtSalesQuantity.tag=1002;
- _txtSalesQuantity.textAlignment=NSTextAlignmentCenter;
- _txtSalesQuantity.layer.borderColor=[LabelGrayTextColor CGColor];
- _txtSalesQuantity.font=orderTextFont;
- [self addSubview:_txtSalesQuantity];
-
- UIButton *addButton=[UIButton buttonWithType:UIButtonTypeCustom];
- [addButton setTitle:@"+" forState:UIControlStateNormal];
- [addButton setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
- addButton.frame=CGRectMake(CGRectGetMaxX(_txtSalesQuantity.frame)-1,CGRectGetMaxY(_lblDiscount.frame)+10,25,25);;
- addButton.layer.borderColor=[LabelGrayTextColor CGColor];
- addButton.layer.borderWidth=1.0;
- addButton.userInteractionEnabled=YES;
- [addButton addTarget:self action:@selector(addQuantity) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:addButton];
-
- UIView *bottomSeparator=[[UIView alloc]init];
- bottomSeparator.frame=CGRectMake(0,CGRectGetMaxY(salesPriceView.frame)+10,Screen_Width, 10);
- bottomSeparator.backgroundColor=LineBackgroundColor;
- [self addSubview:bottomSeparator];
- // 未完成状态,编辑状态商品,转销售或转采购数量>0,不能修改价格和删除;
- if(_editStatus==5){
- NSString *flag=_inventoryModel.flag;
- if([flag isEqualToString:@"modify"]){
- _vDelete.userInteractionEnabled = NO;
- _txtSalesPrice.enabled=NO;
- _txtSalesQuantity.enabled=NO;
- substractButton.userInteractionEnabled=NO;
- addButton.userInteractionEnabled=NO;
- }
- }
- else if(_editStatus==7){
- _txtSalesQuantity.enabled=NO;
- substractButton.userInteractionEnabled=NO;
- addButton.userInteractionEnabled=NO;
- _btnUsePosition.userInteractionEnabled=NO;
- _txtSalesPrice.enabled=NO;
- _vDelete.userInteractionEnabled = NO;
- }
- else if(_editStatus==10){
- _txtSalesQuantity.enabled=NO;
- substractButton.userInteractionEnabled=NO;
- addButton.userInteractionEnabled=NO;
- _btnUsePosition.userInteractionEnabled=NO;
- _txtSalesPrice.enabled=NO;
- _txtRemarks.enabled=NO;
- _vDelete.userInteractionEnabled = NO;
- }
- else if(_editStatus==4){
- _vDelete.userInteractionEnabled = NO;
- _txtSalesPrice.enabled=NO;
- _txtSalesQuantity.enabled=NO;
- substractButton.userInteractionEnabled=NO;
- addButton.userInteractionEnabled=NO;
- }
- if(editFlag == 3){
- _vDelete.userInteractionEnabled = NO;
- _txtSalesPrice.enabled=NO;
- }
- }
- -(void)deleteOrder{
-
- if([self.orderDelegate respondsToSelector:@selector(deleteOrderDetail:)])
- {
- [self.orderDelegate deleteOrderDetail:_cellIndex];
-
- }
-
- }
- #pragma mark - 委托函数
- /**
- textField回调函数
- */
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
- {
- NSCharacterSet *cs;
- if(textField == _txtSalesQuantity)
- {
- cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERSANDDOT] invertedSet];
- NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
- BOOL basicTest = [string isEqualToString:filtered];
- if(!basicTest)
- {
-
- return NO;
- }
- }
- if(textField == _txtSalesPrice)
- {
- cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERSANDDOT] invertedSet];
- NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
- BOOL basicTest = [string isEqualToString:filtered];
- if(!basicTest)
- {
- return NO;
- }
- }
-
- return YES;
- }
- /**
- textField失去焦点回调函数
- */
- - (void) textFieldDidEndEditing:(UITextField *) field
- {
- if(field.tag==1001){
- NSString *salesPrice=field.text;
- if(salesPrice==nil||[salesPrice isEqualToString:@""]||[salesPrice isEqualToString:@"."]){
- field.text = _inventoryModel.salesPrice;
- return;
- }
- _inventoryModel.salesPrice=salesPrice;
- double markedPrice= [ _inventoryModel.markedPrice doubleValue];
- if(markedPrice>0){
- double discount= [_inventoryModel.salesPrice doubleValue]/markedPrice*100;
- NSString *discountStr= [NSString stringWithFormat:@"%.2f",discount];
- _inventoryModel.discount=discountStr;
- }
- else{
- _inventoryModel.discount=@"100";
- }
- if([self.orderDelegate respondsToSelector:@selector(updateNewSalesGoodsDetail:textField:)])
- {
- [self.orderDelegate updateNewSalesGoodsDetail:self textField:_txtSalesPrice];
-
- }
-
- [self updateFrame];
-
- }
- else if(field.tag==1002){
- NSString *salesQuantity=field.text;
- if(salesQuantity==nil||[salesQuantity isEqualToString:@""]||[salesQuantity isEqualToString:@"."]){
- field.text = _inventoryModel.salesQuantity;
- return;
- }
- double salesQuantityValue=[salesQuantity doubleValue];
- NSInteger circulateType=_inventoryModel.circulateType;
- NSString *decimalPlaces=_inventoryModel.decimalPlaces;
- double acreage=_inventoryModel.acreage;
- OrderQuantity *quantity=[OrderQuantity new];
- salesQuantity= [quantity calculateNewOrderDetailQuantity:circulateType decimalPlaces:decimalPlaces quantity:salesQuantity acreage:acreage];
-
- _inventoryModel.salesQuantity=salesQuantity;
- field.text = _inventoryModel.salesQuantity;
- if([self.orderDelegate respondsToSelector:@selector(updateNewSalesGoodsDetail:textField:)])
- {
- [self.orderDelegate updateNewSalesGoodsDetail:self textField:_txtSalesQuantity];
-
- }
- }
- else if(field.tag==1003){
- NSString *remarks=field.text;
- if(remarks==nil){
- remarks=@"";
- }
- _inventoryModel.remarks=remarks;
- if([self.orderDelegate respondsToSelector:@selector(updateNewSalesGoodsDetail:textField:)])
- {
- [self.orderDelegate updateNewSalesGoodsDetail:self textField:_txtRemarks];
-
- }
- }
-
- }
- -(void)addQuantity{
- NSString *salesQuantity= _txtSalesQuantity.text;
- if(salesQuantity!=nil){
- if([salesQuantity isEqualToString:@"."]){
- return;
- }
- double quan=[salesQuantity doubleValue];
- NSInteger circulateType= _inventoryModel.circulateType;
- NSString *decimalPlaces=_inventoryModel.decimalPlaces;
- double acreage=_inventoryModel.acreage;
-
- if(circulateType==2){
- if([self.orderDelegate respondsToSelector:@selector(showNewOrderDetailError:)])
- {
-
- [self.orderDelegate showNewOrderDetailError:@"请手动输入商品数量"];
- return;
- }
- }
- ++quan;
- salesQuantity=[NSString stringWithFormat:@"%lf",quan];
- OrderQuantity *quantity=[OrderQuantity new];
- salesQuantity= [quantity calculateNewOrderDetailQuantity:circulateType decimalPlaces:decimalPlaces quantity:salesQuantity acreage:acreage];
-
-
- _inventoryModel.salesQuantity=salesQuantity;
- _txtSalesQuantity.text = _inventoryModel.salesQuantity;
- if([self.orderDelegate respondsToSelector:@selector(updateNewSalesGoodsDetail:textField:)])
- {
- [self.orderDelegate updateNewSalesGoodsDetail:self textField:_txtSalesQuantity];
-
- }
-
- }
- }
- -(void)substractQuantity{
- NSString *salesQuantity= _txtSalesQuantity.text;
- if(salesQuantity!=nil){
- if([salesQuantity isEqualToString:@"."]){
- return;
- }
- double quan=[salesQuantity doubleValue];
- NSInteger circulateType= _inventoryModel.circulateType;
- NSString *decimalPlaces=_inventoryModel.decimalPlaces;
- double acreage=_inventoryModel.acreage;
-
- if(circulateType==2){
- if([self.orderDelegate respondsToSelector:@selector(showNewOrderDetailError:)])
- {
-
- [self.orderDelegate showNewOrderDetailError:@"请手动输入商品数量"];
- return;
- }
- }
- --quan;
- if(quan<0){
- quan=0;
- }
- salesQuantity=[NSString stringWithFormat:@"%lf",quan];
- OrderQuantity *quantity=[OrderQuantity new];
- salesQuantity= [quantity calculateNewOrderDetailQuantity:circulateType decimalPlaces:decimalPlaces quantity:salesQuantity acreage:acreage];
- _inventoryModel.salesQuantity=salesQuantity;
- _txtSalesQuantity.text = _inventoryModel.salesQuantity;
- if([self.orderDelegate respondsToSelector:@selector(updateNewSalesGoodsDetail:textField:)])
- {
- [self.orderDelegate updateNewSalesGoodsDetail:self textField:_txtSalesQuantity];
-
- }
-
- }
- }
- -(void)clickUsePosition{
- if([self.orderDelegate respondsToSelector:@selector(goUsePosition:)])
- {
-
- [self.orderDelegate goUsePosition:_cellIndex];
-
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- }
- /**
- 更新标价和折扣
- */
- - (void) updateFrame{
- NSString *discount=_inventoryModel.discount;
- if(discount==nil){
- discount=@"0.0%";
- }
- else{
- discount=[NSString stringWithFormat:@"%@%@",discount,@"%"];
- }
- NSString *markedPrice=_inventoryModel.markedPrice;
-
- _lblDiscount.text = [NSString stringWithFormat:@"标价:%@ 折扣:%@",markedPrice,discount];
- _lblDiscount.font = [UIFont systemFontOfSize:13];
- _lblDiscount.textColor = [UIColor redColor];
- [_lblDiscount sizeToFit];
-
- _lblDiscount.frame = CGRectMake(Screen_Width-CGRectGetWidth(_lblDiscount.frame)-10, CGRectGetMaxY(_middleSeparator.frame)+10, CGRectGetWidth(_lblDiscount.frame), CGRectGetHeight(_lblDiscount.frame));
- }
- @end
|