// // SalesOutStorageListDetailModel.m // IBOSSmini // // Created by guan hong hou on 2018/4/11. // Copyright © 2018年 elongtian. All rights reserved. // #import "SalesOutStorageListDetailModel.h" @implementation SalesOutStorageListDetailModel -(void)parseDic:(NSDictionary *)dic{ if(dic!=nil){ _detailId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"DetailID"]integerValue]]; _deliveryId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"DeliveryID"]integerValue]]; _inventoryId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"InventoryID"]integerValue]]; _codeId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"CodeID"]integerValue]]; _code=[dic objectForKey:@"Code"]; _onlyCode=[dic objectForKey:@"OnlyCode"]; _brandId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"BrandID"]integerValue]]; _brandName=[dic objectForKey:@"BrandName"]; _kindId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"KindID"]integerValue]]; _kindName=[dic objectForKey:@"KindName"]; _varietyId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"VarietyID"]integerValue]]; _varietyName=[dic objectForKey:@"VarietyName"]; _seriesId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"SeriesID"]integerValue]]; _seriesName=[dic objectForKey:@"SeriesName"]; _unitId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"UnitID"]integerValue]]; _unitName=[dic objectForKey:@"UnitName"]; _decimalPlaces=[[dic objectForKey:@"DecimalPlaces"]integerValue]; _package=[[dic objectForKey:@"Package"]stringValue]; double weightValue=[[dic objectForKey:@"Weight"]doubleValue]; _weight=[NSString stringWithFormat:@"%.6f",weightValue]; double acreageValue=[[dic objectForKey:@"Acreage"]doubleValue]; _acreage=[NSString stringWithFormat:@"%.6f",acreageValue]; double deliveryQuantityValue=[[dic objectForKey:@"DeliveryQuantity"]doubleValue]; _deliveryQuantity=[NSString stringWithFormat:@"%.6f",deliveryQuantityValue]; NSInteger circulateTypeValue=[[dic objectForKey:@"CirculateType"]integerValue]; _circulateType=[NSString stringWithFormat:@"%d",circulateTypeValue]; double M2Value; if(_acreage!=nil&&_acreage.length>0){ if(circulateTypeValue==1){ M2Value=acreageValue*deliveryQuantityValue; _M2=[NSString stringWithFormat:@"%.6f",M2Value]; } else{ _M2=_deliveryQuantity; } } double volumeValue=[[dic objectForKey:@"Volume"]doubleValue]; _volume=[NSString stringWithFormat:@"%.6f",volumeValue]; double balanceQuantityValue=[[dic objectForKey:@"BalanceQuantity"]doubleValue]; _balanceQuantity=[NSString stringWithFormat:@"%.6f",balanceQuantityValue]; if(circulateTypeValue==1){ if([_package integerValue]>0){ if(deliveryQuantityValue>=0){ _box = [NSString stringWithFormat:@"%ld",(long)floor(deliveryQuantityValue/[_package integerValue])]; } else{ _box=[NSString stringWithFormat:@"%ld",(long)ceil(deliveryQuantityValue/[_package integerValue])]; } _piece = [NSString stringWithFormat:@"%d",(int)deliveryQuantityValue%[_package integerValue]]; } } else if(circulateTypeValue==2){ if([_package integerValue]>0&&[_acreage doubleValue]>0){ long pieces=0; if(deliveryQuantityValue>=0){ pieces=ceil(deliveryQuantityValue/[_acreage doubleValue]); _box=[NSString stringWithFormat:@"%ld",(long)floor(pieces/[_package integerValue])]; } else{ pieces=floor(deliveryQuantityValue/[_acreage doubleValue]); _box=[NSString stringWithFormat:@"%ld",(long)ceil(pieces/[_package integerValue])]; } _piece=[NSString stringWithFormat:@"%d",(int)pieces%[_package integerValue]]; } } else{ _box=@"0"; _piece=@"1"; } _gradeId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"GradeID"]integerValue]]; _gradeName=[dic objectForKey:@"GradeName"]; _goodsCirculateTypeName=[dic objectForKey:@"GoodsCirculateTypeName"]; _specification=[dic objectForKey:@"Specification"]; _colorNumber=[dic objectForKey:@"ColorNumber"]; _warehouseId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"WarehouseID"]integerValue]]; _warehouseName=[dic objectForKey:@"WarehouseName"]; _positionNumber=[dic objectForKey:@"PositionNumber"]; double sendQuantityValue=[[dic objectForKey:@"SendQuantity"]doubleValue]; _sendQuantity=[NSString stringWithFormat:@"%.6f",sendQuantityValue]; double deliveryPriceValue=[[dic objectForKey:@"DeliveryPrice"]doubleValue]; _deliveryPrice=[NSString stringWithFormat:@"%.6f",deliveryPriceValue]; _accountDate= [DateFormat dateFormatSplit:[dic objectForKey:@"AccountDate"]]; _remarks=[dic objectForKey:@"Remarks"]; double returnQuantityValue=[[dic objectForKey:@"ReturnQuantity"]doubleValue]; _returnQuantity=[NSString stringWithFormat:@"%.6f",returnQuantityValue]; double salesPriceValue=[[dic objectForKey:@"SalesPrice"]doubleValue]; _salesPrice=[NSString stringWithFormat:@"%.2f",salesPriceValue]; _salesNo=[dic objectForKey:@"SalesNo"]; _organizationName=[dic objectForKey:@"OrganizationName"]; _staffName=[dic objectForKey:@"StaffName"]; _goodsRemarks=[dic objectForKey:@"GoodsRemarks"]; _goodsName=[dic objectForKey:@"GoodsName"]; _expandAtrribute=[dic objectForKey:@"ExpandAttribute"]; _expandAtrribute2=[dic objectForKey:@"ExpandAttribute2"]; _orderNo=[dic objectForKey:@"OrderNo"]; _goodsCirculateTypeName=[dic objectForKey:@"GoodsCirculateTypeName"]; _secondaryBusinessDepartment=[dic objectForKey:@"OrganizationNameToo"]; _secondaryStaff=[dic objectForKey:@"StaffNameToo"]; } } @end