OtherOutStorageListDetailModel.m 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // OtherOutStorageListDetailModel.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/27.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "OtherOutStorageListDetailModel.h"
  9. @implementation OtherOutStorageListDetailModel
  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. _outQuantity=[NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"DeliveryQuantity"]doubleValue]];
  24. _accountDate=[DateFormat dateFormatSplit:[dic objectForKey:@"AccountDate"]];
  25. _package=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"Package"]integerValue]];
  26. _unitName=[dic objectForKey:@"UnitName"];
  27. _circulateTypeName=[dic objectForKey:@"GoodsCirculateTypeName"];
  28. _weight=[NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Weight"]doubleValue]];
  29. _acreage=[NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Acreage"]doubleValue]];
  30. _volume=[NSString stringWithFormat:@"%.6f",[[dic objectForKey:@"Volume"]doubleValue]];
  31. _goodsName=[dic objectForKey:@"GoodsName"];
  32. _expandAtrribute=[dic objectForKey:@"ExpandAttribute"];
  33. _expandAtrribute2=[dic objectForKey:@"ExpandAttribute2"];
  34. _goodsRemarks=[dic objectForKey:@"GoodsRemarks"];
  35. _remarks=[dic objectForKey:@"Remarks"];
  36. _circulateType=[[dic objectForKey:@"CirculateType"]integerValue];
  37. double M2Value;
  38. if(_acreage!=nil&&_acreage.length>0){
  39. if(_circulateType==1){
  40. M2Value=[_acreage doubleValue]*[_outQuantity doubleValue];
  41. _M2=[NSString stringWithFormat:@"%.6f",M2Value];
  42. }
  43. else{
  44. _M2=_outQuantity;
  45. }
  46. }
  47. if(_circulateType==1){
  48. if([_package integerValue]>0){
  49. if([_outQuantity doubleValue]>=0){
  50. _box = [NSString stringWithFormat:@"%ld",(long)floor([_outQuantity doubleValue]/[_package integerValue])];
  51. }
  52. else{
  53. _box=[NSString stringWithFormat:@"%ld",(long)ceil([_outQuantity doubleValue]/[_package integerValue])];
  54. }
  55. _piece = [NSString stringWithFormat:@"%d",(int)[_outQuantity doubleValue]%[_package integerValue]];
  56. }
  57. }
  58. else if(_circulateType==2){
  59. if([_package integerValue]>0&&[_acreage doubleValue]>0){
  60. long pieces=0;
  61. if([_outQuantity doubleValue]>=0){
  62. pieces=ceil([_outQuantity doubleValue]/[_acreage doubleValue]);
  63. _box=[NSString stringWithFormat:@"%ld",(long)floor(pieces/[_package integerValue])];
  64. }
  65. else{
  66. pieces=floor([_outQuantity doubleValue]/[_acreage doubleValue]);
  67. _box=[NSString stringWithFormat:@"%ld",(long)ceil(pieces/[_package integerValue])];
  68. }
  69. _piece=[NSString stringWithFormat:@"%d",(int)pieces%[_package integerValue]];
  70. }
  71. }
  72. else{
  73. _box=@"0";
  74. _piece=@"1";
  75. }
  76. }
  77. }
  78. @end