OtherInStorageGoodsListDetailModel.m 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // OtherInStorageGoodsListDetailModel.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/23.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "OtherInStorageGoodsListDetailModel.h"
  9. @implementation OtherInStorageGoodsListDetailModel
  10. -(void)parseDic:(NSDictionary *)dic{
  11. if(dic!=nil){
  12. _onlyCode=[dic objectForKey:@"OnlyCode"];
  13. _goodsCode=[dic objectForKey:@"Code"];
  14. _brandName=[dic objectForKey:@"BrandName"];
  15. _kindName=[dic objectForKey:@"KindName"];
  16. _varietyName=[dic objectForKey:@"VarietyName"];
  17. _seriesName=[dic objectForKey:@"SeriesName"];
  18. _specification=[dic objectForKey:@"Specification"];
  19. _gradeName=[dic objectForKey:@"GradeName"];
  20. _colorNumber=[dic objectForKey:@"ColorNumber"];
  21. _warehouseName=[dic objectForKey:@"WarehouseName"];
  22. _positionNumber=[dic objectForKey:@"PositionNumber"];
  23. _inStorageQuantity=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"EnterQuantity"]doubleValue]];
  24. _package=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"Package"]intValue]];
  25. _circulateType=[[dic objectForKey:@"CirculateType"]integerValue];
  26. _acreage=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Acreage"]doubleValue]];
  27. double M2Value;
  28. if(_acreage!=nil&&_acreage.length>0){
  29. if(_circulateType==1){
  30. M2Value=[_acreage doubleValue]*[_inStorageQuantity doubleValue];
  31. _inStorageAcreage=[NSString stringWithFormat:@"%.6f",M2Value];
  32. }
  33. else{
  34. _inStorageAcreage=_inStorageQuantity;
  35. }
  36. }
  37. if(_circulateType==1){
  38. if([_package integerValue]>0){
  39. if([_inStorageQuantity doubleValue]>=0){
  40. _box = [NSString stringWithFormat:@"%ld",(long)floor([_inStorageQuantity doubleValue]/[_package intValue])];
  41. }
  42. else{
  43. _box=[NSString stringWithFormat:@"%ld",(long)ceil([_inStorageQuantity doubleValue]/[_package integerValue])];
  44. }
  45. _piece = [NSString stringWithFormat:@"%d",(int)[_inStorageQuantity doubleValue]%[_package intValue]];
  46. }
  47. }
  48. else if(_circulateType==2){
  49. if([_package integerValue]>0&&[_acreage doubleValue]>0){
  50. long pieces=0;
  51. if([_inStorageQuantity doubleValue]>=0){
  52. pieces=ceil([_inStorageQuantity doubleValue]/[_acreage doubleValue]);
  53. _box=[NSString stringWithFormat:@"%ld",(long)floor(pieces/[_package integerValue])];
  54. }
  55. else{
  56. pieces=floor([_inStorageQuantity doubleValue]/[_acreage doubleValue]);
  57. _box=[NSString stringWithFormat:@"%ld",(long)ceil(pieces/[_package integerValue])];
  58. }
  59. _piece=[NSString stringWithFormat:@"%d",(int)pieces%[_package intValue]];
  60. }
  61. }
  62. else{
  63. _box=@"0";
  64. _piece=@"1";
  65. }
  66. _accountDate=[DateFormat dateFormatSplit:[dic objectForKey:@"AccountDate"]];
  67. _unitName=[dic objectForKey:@"UnitName"];
  68. _circulateTypeName=[dic objectForKey:@"GoodsCirculateTypeName"];
  69. _weight=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Weight"]doubleValue]];
  70. _volume=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Volume"]doubleValue]];
  71. _goodsName=[dic objectForKey:@"GoodsName"];
  72. _expandAtrribute=[dic objectForKey:@"ExpandAttribute"];
  73. _expandAtrribute2=[dic objectForKey:@"ExpandAttribute2"];
  74. _goodsRemarks=[dic objectForKey:@"GoodsRemarks"];
  75. _remarks=[dic objectForKey:@"Remarks"];
  76. _inStoragePrice=[ NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"EnterPrice"]doubleValue]];
  77. }
  78. }
  79. @end