// // OtherInStorageGoodsListDetailModel.m // IBOSSmini // // Created by guan hong hou on 2018/4/23. // Copyright © 2018年 elongtian. All rights reserved. // #import "OtherInStorageGoodsListDetailModel.h" @implementation OtherInStorageGoodsListDetailModel -(void)parseDic:(NSDictionary *)dic{ if(dic!=nil){ _onlyCode=[dic objectForKey:@"OnlyCode"]; _goodsCode=[dic objectForKey:@"Code"]; _brandName=[dic objectForKey:@"BrandName"]; _kindName=[dic objectForKey:@"KindName"]; _varietyName=[dic objectForKey:@"VarietyName"]; _seriesName=[dic objectForKey:@"SeriesName"]; _specification=[dic objectForKey:@"Specification"]; _gradeName=[dic objectForKey:@"GradeName"]; _colorNumber=[dic objectForKey:@"ColorNumber"]; _warehouseName=[dic objectForKey:@"WarehouseName"]; _positionNumber=[dic objectForKey:@"PositionNumber"]; _inStorageQuantity=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"EnterQuantity"]doubleValue]]; _package=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"Package"]intValue]]; _circulateType=[[dic objectForKey:@"CirculateType"]integerValue]; _acreage=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Acreage"]doubleValue]]; double M2Value; if(_acreage!=nil&&_acreage.length>0){ if(_circulateType==1){ M2Value=[_acreage doubleValue]*[_inStorageQuantity doubleValue]; _inStorageAcreage=[NSString stringWithFormat:@"%.6f",M2Value]; } else{ _inStorageAcreage=_inStorageQuantity; } } if(_circulateType==1){ if([_package integerValue]>0){ if([_inStorageQuantity doubleValue]>=0){ _box = [NSString stringWithFormat:@"%ld",(long)floor([_inStorageQuantity doubleValue]/[_package intValue])]; } else{ _box=[NSString stringWithFormat:@"%ld",(long)ceil([_inStorageQuantity doubleValue]/[_package integerValue])]; } _piece = [NSString stringWithFormat:@"%d",(int)[_inStorageQuantity doubleValue]%[_package intValue]]; } } else if(_circulateType==2){ if([_package integerValue]>0&&[_acreage doubleValue]>0){ long pieces=0; if([_inStorageQuantity doubleValue]>=0){ pieces=ceil([_inStorageQuantity doubleValue]/[_acreage doubleValue]); _box=[NSString stringWithFormat:@"%ld",(long)floor(pieces/[_package integerValue])]; } else{ pieces=floor([_inStorageQuantity doubleValue]/[_acreage doubleValue]); _box=[NSString stringWithFormat:@"%ld",(long)ceil(pieces/[_package integerValue])]; } _piece=[NSString stringWithFormat:@"%d",(int)pieces%[_package intValue]]; } } else{ _box=@"0"; _piece=@"1"; } _accountDate=[DateFormat dateFormatSplit:[dic objectForKey:@"AccountDate"]]; _unitName=[dic objectForKey:@"UnitName"]; _circulateTypeName=[dic objectForKey:@"GoodsCirculateTypeName"]; _weight=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Weight"]doubleValue]]; _volume=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Volume"]doubleValue]]; _goodsName=[dic objectForKey:@"GoodsName"]; _expandAtrribute=[dic objectForKey:@"ExpandAttribute"]; _expandAtrribute2=[dic objectForKey:@"ExpandAttribute2"]; _goodsRemarks=[dic objectForKey:@"GoodsRemarks"]; _remarks=[dic objectForKey:@"Remarks"]; _inStoragePrice=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"EnterPrice"]doubleValue]]; } } @end