SalesOutStorageListDetailModel.m 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //
  2. // SalesOutStorageListDetailModel.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/11.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "SalesOutStorageListDetailModel.h"
  9. @implementation SalesOutStorageListDetailModel
  10. -(void)parseDic:(NSDictionary *)dic{
  11. if(dic!=nil){
  12. _detailId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"DetailID"]integerValue]];
  13. _deliveryId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"DeliveryID"]integerValue]];
  14. _inventoryId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"InventoryID"]integerValue]];
  15. _codeId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"CodeID"]integerValue]];
  16. _code=[dic objectForKey:@"Code"];
  17. _onlyCode=[dic objectForKey:@"OnlyCode"];
  18. _brandId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"BrandID"]integerValue]];
  19. _brandName=[dic objectForKey:@"BrandName"];
  20. _kindId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"KindID"]integerValue]];
  21. _kindName=[dic objectForKey:@"KindName"];
  22. _varietyId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"VarietyID"]integerValue]];
  23. _varietyName=[dic objectForKey:@"VarietyName"];
  24. _seriesId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"SeriesID"]integerValue]];
  25. _seriesName=[dic objectForKey:@"SeriesName"];
  26. _unitId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"UnitID"]integerValue]];
  27. _unitName=[dic objectForKey:@"UnitName"];
  28. _decimalPlaces=[[dic objectForKey:@"DecimalPlaces"]integerValue];
  29. _package=[[dic objectForKey:@"Package"]stringValue];
  30. double weightValue=[[dic objectForKey:@"Weight"]doubleValue];
  31. _weight=[NSString stringWithFormat:@"%.6f",weightValue];
  32. double acreageValue=[[dic objectForKey:@"Acreage"]doubleValue];
  33. _acreage=[NSString stringWithFormat:@"%.6f",acreageValue];
  34. double deliveryQuantityValue=[[dic objectForKey:@"DeliveryQuantity"]doubleValue];
  35. _deliveryQuantity=[NSString stringWithFormat:@"%.6f",deliveryQuantityValue];
  36. NSInteger circulateTypeValue=[[dic objectForKey:@"CirculateType"]integerValue];
  37. _circulateType=[NSString stringWithFormat:@"%d",circulateTypeValue];
  38. double M2Value;
  39. if(_acreage!=nil&&_acreage.length>0){
  40. if(circulateTypeValue==1){
  41. M2Value=acreageValue*deliveryQuantityValue;
  42. _M2=[NSString stringWithFormat:@"%.6f",M2Value];
  43. }
  44. else{
  45. _M2=_deliveryQuantity;
  46. }
  47. }
  48. double volumeValue=[[dic objectForKey:@"Volume"]doubleValue];
  49. _volume=[NSString stringWithFormat:@"%.6f",volumeValue];
  50. double balanceQuantityValue=[[dic objectForKey:@"BalanceQuantity"]doubleValue];
  51. _balanceQuantity=[NSString stringWithFormat:@"%.6f",balanceQuantityValue];
  52. if(circulateTypeValue==1){
  53. if([_package integerValue]>0){
  54. if(deliveryQuantityValue>=0){
  55. _box = [NSString stringWithFormat:@"%ld",(long)floor(deliveryQuantityValue/[_package integerValue])];
  56. }
  57. else{
  58. _box=[NSString stringWithFormat:@"%ld",(long)ceil(deliveryQuantityValue/[_package integerValue])];
  59. }
  60. _piece = [NSString stringWithFormat:@"%d",(int)deliveryQuantityValue%[_package integerValue]];
  61. }
  62. }
  63. else if(circulateTypeValue==2){
  64. if([_package integerValue]>0&&[_acreage doubleValue]>0){
  65. long pieces=0;
  66. if(deliveryQuantityValue>=0){
  67. pieces=ceil(deliveryQuantityValue/[_acreage doubleValue]);
  68. _box=[NSString stringWithFormat:@"%ld",(long)floor(pieces/[_package integerValue])];
  69. }
  70. else{
  71. pieces=floor(deliveryQuantityValue/[_acreage doubleValue]);
  72. _box=[NSString stringWithFormat:@"%ld",(long)ceil(pieces/[_package integerValue])];
  73. }
  74. _piece=[NSString stringWithFormat:@"%d",(int)pieces%[_package integerValue]];
  75. }
  76. }
  77. else{
  78. _box=@"0";
  79. _piece=@"1";
  80. }
  81. _gradeId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"GradeID"]integerValue]];
  82. _gradeName=[dic objectForKey:@"GradeName"];
  83. _goodsCirculateTypeName=[dic objectForKey:@"GoodsCirculateTypeName"];
  84. _specification=[dic objectForKey:@"Specification"];
  85. _colorNumber=[dic objectForKey:@"ColorNumber"];
  86. _warehouseId=[NSString stringWithFormat:@"%d",[[dic objectForKey:@"WarehouseID"]integerValue]];
  87. _warehouseName=[dic objectForKey:@"WarehouseName"];
  88. _positionNumber=[dic objectForKey:@"PositionNumber"];
  89. double sendQuantityValue=[[dic objectForKey:@"SendQuantity"]doubleValue];
  90. _sendQuantity=[NSString stringWithFormat:@"%.6f",sendQuantityValue];
  91. double deliveryPriceValue=[[dic objectForKey:@"DeliveryPrice"]doubleValue];
  92. _deliveryPrice=[NSString stringWithFormat:@"%.6f",deliveryPriceValue];
  93. _accountDate= [DateFormat dateFormatSplit:[dic objectForKey:@"AccountDate"]];
  94. _remarks=[dic objectForKey:@"Remarks"];
  95. double returnQuantityValue=[[dic objectForKey:@"ReturnQuantity"]doubleValue];
  96. _returnQuantity=[NSString stringWithFormat:@"%.6f",returnQuantityValue];
  97. double salesPriceValue=[[dic objectForKey:@"SalesPrice"]doubleValue];
  98. _salesPrice=[NSString stringWithFormat:@"%.2f",salesPriceValue];
  99. _salesNo=[dic objectForKey:@"SalesNo"];
  100. _organizationName=[dic objectForKey:@"OrganizationName"];
  101. _staffName=[dic objectForKey:@"StaffName"];
  102. _goodsRemarks=[dic objectForKey:@"GoodsRemarks"];
  103. _goodsName=[dic objectForKey:@"GoodsName"];
  104. _expandAtrribute=[dic objectForKey:@"ExpandAttribute"];
  105. _expandAtrribute2=[dic objectForKey:@"ExpandAttribute2"];
  106. _orderNo=[dic objectForKey:@"OrderNo"];
  107. _goodsCirculateTypeName=[dic objectForKey:@"GoodsCirculateTypeName"];
  108. _secondaryBusinessDepartment=[dic objectForKey:@"OrganizationNameToo"];
  109. _secondaryStaff=[dic objectForKey:@"StaffNameToo"];
  110. }
  111. }
  112. @end