Commit 7d001db7 authored by 陈俊俊's avatar 陈俊俊

商品

parent 3f96fb30
...@@ -321,6 +321,7 @@ typedef enum : NSUInteger { ...@@ -321,6 +321,7 @@ typedef enum : NSUInteger {
//两个类之间的转换 //两个类之间的转换
- (PurchaseBillProduct *)coverPurchaseProduct:(ShopDetail *)shopDetail{ - (PurchaseBillProduct *)coverPurchaseProduct:(ShopDetail *)shopDetail{
PurchaseBillProduct *billProduct = [[PurchaseBillProduct alloc]init]; PurchaseBillProduct *billProduct = [[PurchaseBillProduct alloc]init];
billProduct.uuid = shopDetail.uuid;
billProduct.product_uuid = shopDetail.product_uuid; billProduct.product_uuid = shopDetail.product_uuid;
billProduct.product_code = shopDetail.product_code; billProduct.product_code = shopDetail.product_code;
billProduct.product_name = shopDetail.merchandise; billProduct.product_name = shopDetail.merchandise;
...@@ -332,7 +333,7 @@ typedef enum : NSUInteger { ...@@ -332,7 +333,7 @@ typedef enum : NSUInteger {
billProduct.basePrice = [NSNumber numberWithFloat:[shopDetail.foundationUnitPrice floatValue]]; billProduct.basePrice = [NSNumber numberWithFloat:[shopDetail.foundationUnitPrice floatValue]];
billProduct.total = [NSNumber numberWithFloat:[shopDetail.totalMoney floatValue]]; billProduct.total = [NSNumber numberWithFloat:[shopDetail.totalMoney floatValue]];
billProduct.remark = shopDetail.remark; billProduct.remark = shopDetail.remark;
billProduct.qpcStr = @"fdsfdsfdsa"; billProduct.qpcStr = shopDetail.packageQpcStr ? shopDetail.packageQpcStr : @"无";
return billProduct; return billProduct;
} }
- (ShopDetail *)coverShopDetail:(PurchaseBillProduct *)billProduct{ - (ShopDetail *)coverShopDetail:(PurchaseBillProduct *)billProduct{
...@@ -349,6 +350,7 @@ typedef enum : NSUInteger { ...@@ -349,6 +350,7 @@ typedef enum : NSUInteger {
shopDetail.foundationUnitPrice= [billProduct.basePrice stringValue]; shopDetail.foundationUnitPrice= [billProduct.basePrice stringValue];
shopDetail.totalMoney= [billProduct.total stringValue]; shopDetail.totalMoney= [billProduct.total stringValue];
shopDetail.remark = billProduct.remark; shopDetail.remark = billProduct.remark;
shopDetail.packageQpcStr = billProduct.qpcStr;
return shopDetail; return shopDetail;
} }
...@@ -356,7 +358,7 @@ typedef enum : NSUInteger { ...@@ -356,7 +358,7 @@ typedef enum : NSUInteger {
NSMutableArray *billArr = [NSMutableArray array]; NSMutableArray *billArr = [NSMutableArray array];
for (NoticeProduct *product in arr) { for (NoticeProduct *product in arr) {
PurchaseBillProduct *billProduct = [PurchaseBillProduct new]; PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
billProduct.uuid = product.uuid; // billProduct.uuid = product.uuid;
billProduct.product_name = product.productName; billProduct.product_name = product.productName;
billProduct.product_uuid = product.productUuid; billProduct.product_uuid = product.productUuid;
billProduct.product_code = product.productCode; billProduct.product_code = product.productCode;
...@@ -368,7 +370,7 @@ typedef enum : NSUInteger { ...@@ -368,7 +370,7 @@ typedef enum : NSUInteger {
billProduct.basePrice = [NSNumber numberWithFloat:0]; billProduct.basePrice = [NSNumber numberWithFloat:0];
billProduct.total = [NSNumber numberWithFloat:0]; billProduct.total = [NSNumber numberWithFloat:0];
billProduct.remark = product.remark; billProduct.remark = product.remark;
billProduct.qpcStr = @""; billProduct.qpcStr = @"";
[billArr addObject:billProduct]; [billArr addObject:billProduct];
} }
return billArr; return billArr;
......
...@@ -35,21 +35,6 @@ ...@@ -35,21 +35,6 @@
if (!self.productArr) { if (!self.productArr) {
self.productArr = [NSMutableArray array]; self.productArr = [NSMutableArray array];
} }
// PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
//
// billProduct.product_name = @"dd";
// billProduct.product_uuid = @"402880e64e287fe2014e28895b8a0032";
// billProduct.product_code = @"农夫山泉";
// billProduct.qpc = [NSNumber numberWithFloat:22];
// billProduct.unit = @"筐";
// billProduct.qty = [NSNumber numberWithFloat:23];
// billProduct.price = [NSNumber numberWithFloat:333];
// billProduct.baseQty = [NSNumber numberWithFloat:333];
// billProduct.basePrice = [NSNumber numberWithFloat:33];
// billProduct.total = [NSNumber numberWithFloat:80];
// billProduct.remark = @"hshshshsh";
// billProduct.qpcStr = @"fdsfdsfdsa";
// [self.productArr addObject:billProduct];
if (self.productArr.count > 0) { if (self.productArr.count > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil];
} }
......
...@@ -144,12 +144,12 @@ ...@@ -144,12 +144,12 @@
self.titleLabel.text = billProduct.product_name; self.titleLabel.text = billProduct.product_name;
self.priceLabel.text = [billProduct.price stringValue]; self.priceLabel.text = [billProduct.price stringValue];
self.countLabel.text = [billProduct.qty stringValue]; self.countLabel.text = [billProduct.qty stringValue];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:%@",billProduct.qpc]; self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@",billProduct.qpc];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@",billProduct.baseQty]; self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",billProduct.baseQty,billProduct.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@",billProduct.qty]; self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",billProduct.qty,@"斤"];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@",billProduct.price]; self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@",billProduct.price];
self.showBasePriceLabel.text = [NSString stringWithFormat:@"基础单价:%@",billProduct.basePrice]; self.showBasePriceLabel.text = [NSString stringWithFormat:@"基础单价:%@",billProduct.basePrice];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@",billProduct.total]; self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@",billProduct.total];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",billProduct.remark]; self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",billProduct.remark];
[self isShowShippingQty:billProduct]; [self isShowShippingQty:billProduct];
} }
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
@property (nonatomic,strong)NSString *product_code;//商品 @property (nonatomic,strong)NSString *product_code;//商品
@property (nonatomic,strong)NSString *packageSpecification;//包装规格 @property (nonatomic,strong)NSString *packageSpecification;//包装规格
@property (nonatomic,strong)NSString *packageQpcStr;//规格描述
@property (nonatomic,strong)NSString *packageQpcUnit;//规格单位
@property (nonatomic,strong)NSString *packageQuantity;//包装数量 @property (nonatomic,strong)NSString *packageQuantity;//包装数量
@property (nonatomic,strong)NSString *packageUnit;//包装单位 @property (nonatomic,strong)NSString *packageUnit;//包装单位
@property (nonatomic,strong)NSString *foundationQuantity;//基础数量 @property (nonatomic,strong)NSString *foundationQuantity;//基础数量
......
...@@ -34,25 +34,25 @@ typedef enum : NSUInteger { ...@@ -34,25 +34,25 @@ typedef enum : NSUInteger {
NSMutableArray *_dataArr; NSMutableArray *_dataArr;
UILabel *_productLabel; UILabel *_productLabel;
UILabel *_PackagingLable; UILabel *_PackagingLable;
HPGrowingTextView *_noteTextView;
UITextField *merchandise; //商品
UITextField *packageSpecification;//包装规格 UITextField *packageSpecification;//包装规格
UITextField *packageQuantity; //包装数量 UITextField *packageQuantity; //包装数量
UITextField *packageUnit; //包装单位
UITextField *foundationQuantity; //基础数量 UITextField *foundationQuantity; //基础数量
UITextField *foundationUnitPrice; //基础单价 UITextField *foundationUnitPrice; //基础单价
UITextField *packageUnitPrice; //包装单价 UITextField *packageUnitPrice; //包装单价
UITextField *totalMoney; //总金额 UITextField *totalMoney; //总金额
UITextField *remark; //备注 HPGrowingTextView *remark; //备注
UILabel *_measureUnitLabel; //默认规格单位
UILabel *_packageCountLabel; //包装数量
UILabel *_baseCountLabel; //基础数量
} }
@property (nonatomic,strong)NSString *titleStr; @property (nonatomic,strong)NSString *productCodeStr;//商品代码
@property (nonatomic,strong)NSString *productCodeStr; @property (nonatomic,strong)NSString *productNameStr;//商品名字
@property (nonatomic,strong)NSString *productNameStr; @property (nonatomic,strong)NSString *productUuidStr;//商品code
@property (nonatomic,strong)NSString *productUuidStr; @property (nonatomic,strong)NSString *productMeasureUnit;//默认规格单位
@property (nonatomic,strong)NSString *beginDateStr; @property (nonatomic,strong)NSString *packageQpcStr; //规格描述
@property (nonatomic,strong)NSString *endDateStr; @property (nonatomic,strong)NSString *packageUintStr; //包装单位
@property (nonatomic,strong)NSString *remarkStr;
@property (nonatomic,strong)NSMutableArray *users;
@end @end
@implementation ShopDetaileViewController @implementation ShopDetaileViewController
...@@ -64,11 +64,7 @@ typedef enum : NSUInteger { ...@@ -64,11 +64,7 @@ typedef enum : NSUInteger {
[self setupSubviews]; [self setupSubviews];
} }
- (void)initData{ - (void)initData{
merchandise=[[UITextField alloc]init];
packageUnit=[[UITextField alloc]init];
merchandise.text=packageUnit.text=NULL;
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
self.users = [NSMutableArray array];
[_dataArr addObject:@"商品"]; [_dataArr addObject:@"商品"];
[_dataArr addObject:@"包装单位"]; [_dataArr addObject:@"包装单位"];
[_dataArr addObject:@"包装规格"]; [_dataArr addObject:@"包装规格"];
...@@ -103,24 +99,43 @@ typedef enum : NSUInteger { ...@@ -103,24 +99,43 @@ typedef enum : NSUInteger {
- (void)setviewsData - (void)setviewsData
{ {
if (self.shopDetail!=nil) { if (self.shopDetail!=nil) {
_productLabel.text=self.shopDetail.merchandise;//商品 //商品
merchandise.text=self.shopDetail.merchandise; _productLabel.text = [NSString stringWithFormat:@"%@[%@]",self.shopDetail.merchandise,self.shopDetail.product_code];
packageUnit.text=self.shopDetail.packageUnit; //包装单位
_PackagingLable.text=self.shopDetail.packageUnit;//包装单位 _PackagingLable.text = self.shopDetail.packageUnit;
packageSpecification.text=self.shopDetail.packageSpecification;//包装规格 _packageCountLabel.text = self.shopDetail.packageUnit;
packageQuantity.text=self.shopDetail.packageQuantity; //包装数量
//包装规格
foundationQuantity.text=self.shopDetail.foundationQuantity; //基础数量 packageSpecification.text=self.shopDetail.packageSpecification;
foundationUnitPrice.text=self.shopDetail.foundationUnitPrice; //基础单价
packageUnitPrice.text=self.shopDetail.packageUnitPrice; //包装单价 //包装规格单位
totalMoney.text=self.shopDetail.totalMoney; //总金额 self.shopDetail.packageQpcUnit ? (_measureUnitLabel.text = self.shopDetail.packageQpcUnit) : (_measureUnitLabel.text = @"斤");
self.shopDetail.packageQpcUnit ? (_baseCountLabel.text = self.shopDetail.packageQpcUnit) : (_baseCountLabel.text = @"斤");
//包装数量
packageQuantity.text=self.shopDetail.packageQuantity;
//基础数量
foundationQuantity.text=self.shopDetail.foundationQuantity;
//基础单价
foundationUnitPrice.text=self.shopDetail.foundationUnitPrice;
//包装单价
packageUnitPrice.text=self.shopDetail.packageUnitPrice;
//总金额
totalMoney.text=self.shopDetail.totalMoney;
//备注
remark.text=self.shopDetail.remark; remark.text=self.shopDetail.remark;
_productLabel.textColor=GXF_CONTENT_COLOR;
_PackagingLable.textColor=GXF_CONTENT_COLOR;
self.productCodeStr = self.shopDetail.product_code; self.productCodeStr = self.shopDetail.product_code;
self.productUuidStr = self.shopDetail.product_uuid; self.productUuidStr = self.shopDetail.product_uuid;
_productLabel.textColor=GXF_CONTENT_COLOR; self.productNameStr = self.shopDetail.merchandise;
_PackagingLable.textColor=GXF_CONTENT_COLOR; self.packageQpcStr = self.shopDetail.packageQpcStr;
self.packageUintStr = self.shopDetail.packageUnit;
self.productMeasureUnit = self.shopDetail.packageQpcUnit.length > 0 ? self.shopDetail.packageQpcUnit : @"斤";
} }
} }
#pragma mark - 按钮点击事件 #pragma mark - 按钮点击事件
...@@ -162,9 +177,7 @@ typedef enum : NSUInteger { ...@@ -162,9 +177,7 @@ typedef enum : NSUInteger {
- (void)clearShopDetail - (void)clearShopDetail
{ {
_productLabel.text=@"选择商品";//商品 _productLabel.text=@"选择商品";//商品
merchandise.text=@"";
packageUnit.text=@"";
_PackagingLable.text=@"选择包装单位";//包装单位 _PackagingLable.text=@"选择包装单位";//包装单位
packageSpecification.text=@"";//包装规格 packageSpecification.text=@"";//包装规格
packageQuantity.text=@""; //包装数量 packageQuantity.text=@""; //包装数量
...@@ -181,18 +194,25 @@ typedef enum : NSUInteger { ...@@ -181,18 +194,25 @@ typedef enum : NSUInteger {
if (!self.shopDetail) { if (!self.shopDetail) {
self.shopDetail=[[ShopDetail alloc]init]; self.shopDetail=[[ShopDetail alloc]init];
} }
self.shopDetail.merchandise=merchandise.text;
self.shopDetail.packageSpecification=packageSpecification.text;
self.shopDetail.packageQuantity=packageQuantity.text;
self.shopDetail.packageUnit=packageUnit.text;
self.shopDetail.foundationQuantity=foundationQuantity.text;
self.shopDetail.foundationUnitPrice=foundationUnitPrice.text;
self.shopDetail.packageUnitPrice=packageUnitPrice.text;
self.shopDetail.totalMoney=totalMoney.text;
self.shopDetail.remark=remark.text;
self.shopDetail.product_code = self.productCodeStr; self.shopDetail.product_code = self.productCodeStr;
self.shopDetail.product_uuid = self.productUuidStr; self.shopDetail.product_uuid = self.productUuidStr;
if (merchandise.text.length == 0 ) { self.shopDetail.merchandise = self.productNameStr;
self.shopDetail.packageSpecification = packageSpecification.text;
self.shopDetail.packageQpcStr = self.packageQpcStr;
self.shopDetail.packageQpcUnit = self.productMeasureUnit;
self.shopDetail.packageUnit = self.packageUintStr;
self.shopDetail.packageQuantity = packageQuantity.text;
self.shopDetail.packageUnitPrice = packageUnitPrice.text;
self.shopDetail.foundationQuantity = foundationQuantity.text;
self.shopDetail.foundationUnitPrice = foundationUnitPrice.text;
self.shopDetail.totalMoney = totalMoney.text;
self.shopDetail.remark = remark.text;
if (self.productNameStr.length == 0 ) {
ShowMessage(@"商品不能为空"); ShowMessage(@"商品不能为空");
return NO; return NO;
} }
...@@ -204,7 +224,7 @@ typedef enum : NSUInteger { ...@@ -204,7 +224,7 @@ typedef enum : NSUInteger {
ShowMessage(@"包装数量不能为空"); ShowMessage(@"包装数量不能为空");
return NO; return NO;
} }
if (packageUnit.text.length == 0) { if (self.packageUintStr.length == 0) {
ShowMessage(@"包装单位不能为空"); ShowMessage(@"包装单位不能为空");
return NO; return NO;
} }
...@@ -224,7 +244,6 @@ typedef enum : NSUInteger { ...@@ -224,7 +244,6 @@ typedef enum : NSUInteger {
return NO; return NO;
} }
return YES; return YES;
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
...@@ -268,65 +287,76 @@ typedef enum : NSUInteger { ...@@ -268,65 +287,76 @@ typedef enum : NSUInteger {
contentLabel.text = @"选择包装单位"; contentLabel.text = @"选择包装单位";
} }
}else }else if(indexPath.row == 8){
{ HPGrowingTextView * remarkTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)]; remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
remarkTextView.minNumberOfLines = 1;
remarkTextView.maxNumberOfLines = 1;
remarkTextView.isScrollable = YES;
remarkTextView.font = GXF_FIFTEENTEN_SIZE;
remarkTextView.textAlignment = NSTextAlignmentRight;
remarkTextView.delegate = self;
remarkTextView.returnKeyType = UIReturnKeyDone;
remarkTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:remarkTextView];
remark=remarkTextView; //备注
}else{
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableHeight)];
textField.textAlignment = NSTextAlignmentRight; textField.textAlignment = NSTextAlignmentRight;
textField.textColor = GXF_CONTENT_COLOR; textField.textColor = GXF_CONTENT_COLOR;
textField.font = FontSize(15); textField.font = FontSize(15);
textField.returnKeyType = UIReturnKeyDone; textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self; textField.delegate = self;
[cell.contentView addSubview:textField]; [cell.contentView addSubview:textField];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame)+ 5, 0, 20, TableHeight)];
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
if (indexPath.row==2) { if (indexPath.row==2) {
packageSpecification=textField;//包装规格 _measureUnitLabel = label;
textField.placeholder = @"输入包装规格"; textField.placeholder = @"输入包装规格";
[textField addTarget:self action:@selector(textChange:) forControlEvents:UIControlEventAllEditingEvents];
packageSpecification=textField;//包装规格
}else if (indexPath.row==3) }else if (indexPath.row==3)
{ {
packageQuantity=textField; //包装数量 _packageCountLabel = label;
textField.placeholder = @"输入包装数量"; textField.placeholder = @"输入包装数量";
[textField addTarget:self action:@selector(textChange:) forControlEvents:UIControlEventAllEditingEvents];
packageQuantity=textField; //包装数量
}else if (indexPath.row==4) }else if (indexPath.row==4)
{ {
_baseCountLabel = label;
[textField setEnabled:NO];
textField.placeholder = @"基础数量";
textField.textColor = [UIColor redColor];
foundationQuantity=textField; //基础数量 foundationQuantity=textField; //基础数量
textField.placeholder = @"输入基础数量";
}else if (indexPath.row==5) }else if (indexPath.row==5)
{ {
label.text = @"元";
textField.placeholder = @"输入基础单价"; textField.placeholder = @"输入基础单价";
[textField addTarget:self action:@selector(textChange:) forControlEvents:UIControlEventAllEditingEvents];
foundationUnitPrice=textField; //基础单价 foundationUnitPrice=textField; //基础单价
textField.frame = CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableHeight);
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame) + 5, 0, 20, TableHeight)];
label.text = @"元";
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
}else if (indexPath.row==6) }else if (indexPath.row==6)
{ {
textField.placeholder = @"输入包装单价";
packageUnitPrice=textField; //包装单价
textField.frame = CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableHeight);
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame) + 5, 0, 20, TableHeight)];
label.text = @"元"; label.text = @"元";
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
}else if (indexPath.row==7)
{
textField.placeholder = @"输入总金额";
totalMoney=textField; //总金额
textField.text = @"0";
textField.frame = CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableHeight);
textField.textColor = [UIColor redColor]; textField.textColor = [UIColor redColor];
textField.text = @"0";
// textField.placeholder = @"包装单价";
[textField setEnabled:NO];
packageUnitPrice=textField; //包装单价
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame)+ 5, 0, 20, TableHeight)]; }else if (indexPath.row==7)
label.text = @"元";
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
}else if (indexPath.row==8)
{ {
remark=textField; //备注 label.text = @"元";
textField.placeholder = @"输入备注内容"; textField.textColor = [UIColor redColor];
[textField setEnabled:NO];
textField.text = @"0";
// textField.placeholder = @"总金额";
totalMoney=textField; //总金额
} }
} }
[self setviewsData]; [self setviewsData];
...@@ -339,11 +369,19 @@ typedef enum : NSUInteger { ...@@ -339,11 +369,19 @@ typedef enum : NSUInteger {
cvc.choseBaseInfo = ^(NSArray *products){ cvc.choseBaseInfo = ^(NSArray *products){
Product *product=products [0]; Product *product=products [0];
_productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code]; _productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
merchandise.text=product.name;
_productLabel.textColor = GXF_CONTENT_COLOR; _productLabel.textColor = GXF_CONTENT_COLOR;
self.productNameStr = product.name; self.productNameStr = product.name;
self.productUuidStr = product.uuid; self.productUuidStr = product.uuid;
self.productCodeStr = product.code; self.productCodeStr = product.code;
self.packageQpcStr = product.qpcStr;
self.productMeasureUnit = product.measureUnit;
if (self.productMeasureUnit.length == 0) {
_measureUnitLabel.text = @"斤";
_baseCountLabel.text = @"斤";
}else{
_measureUnitLabel.text = self.productMeasureUnit;
_baseCountLabel.text = self.productMeasureUnit;
}
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
...@@ -354,8 +392,9 @@ typedef enum : NSUInteger { ...@@ -354,8 +392,9 @@ typedef enum : NSUInteger {
if (products.count > 0) { if (products.count > 0) {
GXFProductUnit *productUnit=products [0]; GXFProductUnit *productUnit=products [0];
_PackagingLable.text = [NSString stringWithFormat:@"%@",productUnit.name]; _PackagingLable.text = [NSString stringWithFormat:@"%@",productUnit.name];
packageUnit.text= [NSString stringWithFormat:@"%@",productUnit.name];
_PackagingLable.textColor = GXF_CONTENT_COLOR; _PackagingLable.textColor = GXF_CONTENT_COLOR;
_packageCountLabel.text = productUnit.name;
self.packageUintStr = productUnit.name;
} }
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
...@@ -363,13 +402,35 @@ typedef enum : NSUInteger { ...@@ -363,13 +402,35 @@ typedef enum : NSUInteger {
} }
} }
#pragma mark - textFiled事件
- (void)textChange:(UITextField *)textField{
if (textField == packageSpecification || textField == packageQuantity) {
if (packageSpecification.text.length > 0 && packageQuantity.text.length > 0 ) {
int baseCount = [packageSpecification.text intValue] * [packageQuantity.text intValue];
foundationQuantity.text = [NSString stringWithFormat:@"%d",baseCount];
[self setTotalMoney];
}
}else if(textField == foundationUnitPrice){
[self setTotalMoney];
}
}
- (void)setTotalMoney{
if (foundationQuantity.text.length > 0 && foundationUnitPrice.text.length > 0) {
//基础单价 * 基础数量 / 包装数量
float totalPrice = [foundationQuantity.text floatValue] * [foundationUnitPrice.text floatValue];
float packagePrice = totalPrice / [packageQuantity.text floatValue];
packageUnitPrice.text = [NSString stringWithFormat:@"%.1f",packagePrice];
totalMoney.text = [NSString stringWithFormat:@"%.1f",totalPrice];
}
}
#pragma mark delegate #pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{ - (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[_noteTextView resignFirstResponder]; [remark resignFirstResponder];
return YES; return YES;
} }
- (void)keyboardHidden{ - (void)keyboardHidden{
[_noteTextView resignFirstResponder]; [remark resignFirstResponder];
} }
- (void)viewWillDisappear:(BOOL)animated{ - (void)viewWillDisappear:(BOOL)animated{
......
...@@ -297,6 +297,7 @@ typedef enum : NSUInteger { ...@@ -297,6 +297,7 @@ typedef enum : NSUInteger {
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init]; ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
if (billProduct) { if (billProduct) {
svc.title = @"编辑商品";
ShopDetail *shopDetail=[self coverShopDetail:billProduct]; ShopDetail *shopDetail=[self coverShopDetail:billProduct];
shopDetail.IsXiuGai=YES; shopDetail.IsXiuGai=YES;
svc.choseShopDetail = ^(ShopDetail *Detail){ svc.choseShopDetail = ^(ShopDetail *Detail){
...@@ -309,14 +310,13 @@ typedef enum : NSUInteger { ...@@ -309,14 +310,13 @@ typedef enum : NSUInteger {
}; };
svc.shopDetail=shopDetail; svc.shopDetail=shopDetail;
}else{ }else{
svc.title = @"添加商品";
// 回调 // 回调
svc.choseShopDetail = ^(ShopDetail *shopDetail){ svc.choseShopDetail = ^(ShopDetail *shopDetail){
TransportPdtDetail *tdetail = [self coverTransportPdtDetail:shopDetail]; TransportPdtDetail *tdetail = [self coverTransportPdtDetail:shopDetail];
[_bottomView refreshProduct:tdetail]; [_bottomView refreshProduct:tdetail];
}; };
} }
svc.title = [IBTCommon localizableString:@"AddShopDetail"];
[self PushViewController:svc animated:YES]; [self PushViewController:svc animated:YES];
} }
...@@ -334,7 +334,7 @@ typedef enum : NSUInteger { ...@@ -334,7 +334,7 @@ typedef enum : NSUInteger {
billProduct.baseQty = [NSNumber numberWithFloat:[shopDetail.foundationQuantity floatValue]]; billProduct.baseQty = [NSNumber numberWithFloat:[shopDetail.foundationQuantity floatValue]];
billProduct.total = [NSNumber numberWithFloat:[shopDetail.totalMoney floatValue]]; billProduct.total = [NSNumber numberWithFloat:[shopDetail.totalMoney floatValue]];
billProduct.note = shopDetail.remark; billProduct.note = shopDetail.remark;
billProduct.qpcStr = @"fdsfdsfdsa"; billProduct.qpcStr = shopDetail.packageQpcStr ? shopDetail.packageQpcStr : @"无" ;
return billProduct; return billProduct;
} }
- (ShopDetail *)coverShopDetail:(TransportPdtDetail *)billProduct{ - (ShopDetail *)coverShopDetail:(TransportPdtDetail *)billProduct{
......
...@@ -225,8 +225,12 @@ ...@@ -225,8 +225,12 @@
- (void)sureClick{ - (void)sureClick{
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
if (self.indexArr.count > 0) { if (self.indexArr.count > 0) {
NSLog(@"%@",self.indexArr); NSMutableArray*arr = [NSMutableArray array];
self.getProchaseProduct(self.indexArr); for (TransportPdtDetail *detail in self.indexArr) {
detail.uuid = nil;
[arr addObject:detail];
}
self.getProchaseProduct(arr);
} }
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
......
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
// cell.lineLabel.y = ShowHeight + TableHeight -1; // cell.lineLabel.y = ShowHeight + TableHeight -1;
// cell.showView.height = ShowHeight; // cell.showView.height = ShowHeight;
// cell.backgroundColor = [UIColor whiteColor]; // cell.backgroundColor = [UIColor whiteColor];
[self.selectArr addObject:billProduct]; [self.selectArr addObject:billProduct];
// [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_getSelectPurchaseProduct object:nil userInfo:@{@"selectArr":billProduct,@"state":@"add"}]; // [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_getSelectPurchaseProduct object:nil userInfo:@{@"selectArr":billProduct,@"state":@"add"}];
}else{ }else{
......
...@@ -145,12 +145,12 @@ ...@@ -145,12 +145,12 @@
self.titleLabel.text = pdtDetail.productName; self.titleLabel.text = pdtDetail.productName;
self.priceLabel.text = [pdtDetail.price stringValue]; self.priceLabel.text = [pdtDetail.price stringValue];
self.countLabel.text = [pdtDetail.qty stringValue]; self.countLabel.text = [pdtDetail.qty stringValue];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:%@",pdtDetail.qpc]; self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@",pdtDetail.qpc];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@",pdtDetail.baseQty]; self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",pdtDetail.baseQty,pdtDetail.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@",pdtDetail.qty]; self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",pdtDetail.qty,@"斤"];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@",pdtDetail.price]; self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@",pdtDetail.price];
self.showPurchaseLabel.text = [NSString stringWithFormat:@"采购单号:%@",pdtDetail.purchasebillnumber.length > 0 ? pdtDetail.purchasebillnumber: @"无"]; self.showPurchaseLabel.text = [NSString stringWithFormat:@"采购单号:%@",pdtDetail.purchasebillnumber.length > 0 ? pdtDetail.purchasebillnumber: @"无"];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@",pdtDetail.total]; self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@",pdtDetail.total];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note]; self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note];
} }
......
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