// // GoodsItemModel.m // IBOSSIPAD // // Created by iHope on 14-7-24. // Copyright (c) 2014年 elongtian. All rights reserved. // #import "GoodsSearchItemModel.h" #import "OrderQuantity.h" @implementation GoodsSearchItemModel -(void)parseDic:(NSDictionary *)dic { if(dic!=nil){ _code=[dic objectForKey:@"Code"]; _onlyCode=[dic objectForKey:@"OnlyCode"]; _brandName=[dic objectForKey:@"BrandName"]; _gradeName=[dic objectForKey:@"GradeName"]; _specification=[dic objectForKey:@"Specification"]; _colorNumber=[dic objectForKey:@"ColorNumber"]; _warehouseName=[dic objectForKey:@"WarehouseName"]; _positionNumber=[dic objectForKey:@"PositionNumber"]; _inventoryQuantity=[NSString stringWithFormat:@"%.2f",[[dic objectForKey:@"InventoryQuantity"] doubleValue]]; _balanceQuantity=[NSString stringWithFormat:@"%.2f",[[dic objectForKey:@"BalanceQuantity"]doubleValue]]; NSInteger inventoryIdValue= [[dic objectForKey:@"InventoryID"]integerValue]; _inventoryID=[NSString stringWithFormat:@"%ld",(long)inventoryIdValue]; _photo=[dic objectForKey:@"Photo"]; _decimalPlaces=[[dic objectForKey:@"DecimalPlaces"]integerValue]; _circulateType=[[dic objectForKey:@"CirculateType" ]integerValue]; _acreage=[[dic objectForKey:@"Acreage" ] doubleValue]; OrderQuantity *quantity=[OrderQuantity new]; NSString *salesQuantity=@"1"; NSString *calculateQuantity= [quantity calculateOrderQuantity:_circulateType decimalPlaces:[NSString stringWithFormat:@"%ld",(long)_decimalPlaces] quantity:salesQuantity acreage:_acreage]; _salesPrice=@"0"; _salesQuantity=calculateQuantity; _markedPrice=@"0"; _remarks=@""; _isChecked=NO; } } - (id)copyWithZone:(nullable NSZone *)zone{ GoodsSearchItemModel *searchItemModel = [[self class] allocWithZone:zone]; searchItemModel.code=_code; searchItemModel.onlyCode=_onlyCode; searchItemModel.brandName=_brandName; searchItemModel.gradeName=_gradeName; searchItemModel.specification=_specification; searchItemModel.colorNumber=_colorNumber; searchItemModel.warehouseName=_warehouseName; searchItemModel.positionNumber=_positionNumber; searchItemModel.balanceQuantity=_balanceQuantity; searchItemModel.inventoryQuantity=_inventoryQuantity; searchItemModel.inventoryID=_inventoryID; searchItemModel.salesQuantity=_salesQuantity; searchItemModel.salesPrice=_salesPrice; searchItemModel.remarks=_remarks; searchItemModel.markedPrice=_markedPrice; searchItemModel.photo=_photo; searchItemModel.isChecked=_isChecked; searchItemModel.circulateType=_circulateType; searchItemModel.acreage=_acreage; searchItemModel.decimalPlaces=_decimalPlaces; return searchItemModel; } @end