InventoryCostModel.m 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //
  2. // InventoryCostModel.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2020/11/17.
  6. // Copyright © 2020 elongtian. All rights reserved.
  7. //
  8. #import "InventoryCostModel.h"
  9. @implementation InventoryCostModel
  10. /*!
  11. * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
  12. * 前:模型的属性 后:字典里的属性
  13. */
  14. + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
  15. return @{
  16. @"code":@"Code",
  17. @"codeId":@"CodeID",
  18. @"onlyCode":@"OnlyCode",
  19. @"wareHouseName":@"WarehouseName",
  20. @"goodName":@"GoodsName",
  21. @"specification":@"Specification",
  22. @"colorNumber":@"ColorNumber",
  23. @"brandName":@"BrandName",
  24. @"gradeName":@"GradeName",
  25. @"positionNumber":@"PositionNumber",
  26. @"inventoryQuantity":@"InventoryQuantity",
  27. @"costPrice":@"CostPrice",
  28. @"circulateType":@"CirculateType",
  29. @"package":@"Package",
  30. @"occupyQuantity":@"OccupyQuantity",
  31. @"decimalPlaces":@"DecimalPlaces",
  32. @"inventoryId":@"InventoryID",
  33. @"acreage":@"Acreage",
  34. @"specification":@"Specification",
  35. @"kindName":@"KindName",
  36. @"varietyName":@"VarietyName",
  37. @"inventoryAmount":@"InventoryAmount",
  38. @"seriesName":@"SeriesName",
  39. @"timelyCost":@"TimelyCost",
  40. @"inventoryTimelyAmount":@"InventoryTimelyAmount",
  41. @"lastInventoryQuantity":@"LastInventoryQuantity",
  42. @"lastInventoryAmount":@"LastInventoryAmount",
  43. @"thisInventoryAmount":@"ThisInventoryAmount",
  44. @"thisInventoryQuantity":@"ThisInventoryQuantity",
  45. @"balanceQuantity":@"BalanceQuantity",
  46. @"balanceAmount":@"BalanceAmount",
  47. @"lastCarryOverCost":@"LastCarryoverCost",
  48. @"occupyQuantityAmount":@"OccupyQuantityAmount",
  49. @"noDeliveryQuantity":@"NoDeliveryQuantity",
  50. @"noDeliveryQuantityAmount":@"NoDeliveryQuantityAmount",
  51. @"noBookOccupyQuantity":@"NoBookOccupyQuantity",
  52. @"noBookOccupyQuantityAmount":@"NoBookOccupyQuantityAmount",
  53. @"expandAttribute":@"ExpandAttribute",
  54. @"expandAttribute2":@"ExpandAttribute2",
  55. @"standardProcurementPrice":@"StandardProcurementPrice",
  56. @"goodsRemarks":@"GoodsRemarks"
  57. };
  58. }
  59. - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
  60. if(dic!=nil){
  61. int inventoryIdValue=[[dic objectForKey:@"InventoryID"]intValue];
  62. _inventoryId=[NSString stringWithFormat:@"%d",inventoryIdValue];
  63. int decimalPlacesValue=[[dic objectForKey:@"DecimalPlaces"]intValue];
  64. double lastInventoryQuantityValue=[[dic objectForKey:@"InventoryID"]doubleValue];
  65. double thisInventoryQuantityValue=[[dic objectForKey:@"ThisInventoryQuantity"]doubleValue];
  66. double balanceQuantityValue=[[dic objectForKey:@"BalanceQuantity"]doubleValue];
  67. double noDeliveryQuantityValue=[[dic objectForKey:@"NoDeliveryQuantity"]doubleValue];
  68. double noBookOccupyQuantityValue=[[dic objectForKey:@"NoBookOccupyQuantity"]doubleValue];
  69. double inventoryQuantityValue=[[dic objectForKey:@"InventoryQuantity"]doubleValue];
  70. NSString* decimalFormat = [NSString stringWithFormat:@"%@%d%@",@"%.",decimalPlacesValue,@"f" ];
  71. _lastInventoryQuantity=[NSString stringWithFormat:decimalFormat,lastInventoryQuantityValue];
  72. _thisInventoryQuantity=[NSString stringWithFormat:decimalFormat,thisInventoryQuantityValue];
  73. _balanceQuantity=[NSString stringWithFormat:decimalFormat,balanceQuantityValue];
  74. _noDeliveryQuantity=[NSString stringWithFormat:decimalFormat,noDeliveryQuantityValue];
  75. _noBookOccupyQuantity=[NSString stringWithFormat:decimalFormat,noBookOccupyQuantityValue];
  76. _inventoryQuantity=[NSString stringWithFormat:decimalFormat,inventoryQuantityValue];
  77. double costPriceValue=[[dic objectForKey:@"CostPrice"]doubleValue];
  78. _costPrice=[NSString stringWithFormat:@"¥%.2f",costPriceValue];
  79. double inventoryAmount=[[dic objectForKey:@"InventoryAmount"]doubleValue];
  80. _inventoryAmount=[NSString stringWithFormat:@"¥%.2f",inventoryAmount];
  81. double timelyCostValue=[[dic objectForKey:@"TimelyCost"]doubleValue];
  82. _timelyCost=[NSString stringWithFormat:@"¥%.2f",timelyCostValue];
  83. double inventoryTimelyAmountValue=[[dic objectForKey:@"InventoryTimelyAmount"]doubleValue];
  84. _inventoryTimelyAmount=[NSString stringWithFormat:@"¥%.2f",inventoryTimelyAmountValue];
  85. double lastInventoryAmountValue=[[dic objectForKey:@"LastInventoryAmount"]doubleValue];
  86. _lastInventoryAmount=[NSString stringWithFormat:@"¥%.2f",lastInventoryAmountValue];
  87. double thisInventoryAmountValue=[[dic objectForKey:@"ThisInventoryAmount"]doubleValue];
  88. _thisInventoryAmount=[NSString stringWithFormat:@"¥%.2f",thisInventoryAmountValue];
  89. double balanceAmountValue=[[dic objectForKey:@"BalanceAmount"]doubleValue];
  90. _balanceAmount=[NSString stringWithFormat:@"¥%.2f",balanceAmountValue];
  91. double occupyQuantityAmountValue=[[dic objectForKey:@"OccupyQuantityAmount"]doubleValue];
  92. _occupyQuantityAmount=[NSString stringWithFormat:@"¥%.2f",occupyQuantityAmountValue];
  93. double noDeliveryQuantityAmountValue=[[dic objectForKey:@"NoDeliveryQuantityAmount"]doubleValue];
  94. _noDeliveryQuantityAmount=[NSString stringWithFormat:@"¥%.2f",noDeliveryQuantityAmountValue];
  95. double noBookOccupyQuantityAmountValue=[[dic objectForKey:@"NoBookOccupyQuantityAmount"]doubleValue];
  96. _noBookOccupyQuantityAmount=[NSString stringWithFormat:@"¥%.2f",noBookOccupyQuantityAmountValue];
  97. double standardProcurementPriceValue=[[dic objectForKey:@"StandardProcurementPrice"]doubleValue];
  98. _standardProcurementPrice=[NSString stringWithFormat:@"¥%.2f",standardProcurementPriceValue];
  99. }
  100. return YES;
  101. }
  102. @end