RepairReceiptDetailModel.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // RepairReceiptDetailModel.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2017/8/1.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. //功能描述:维修回执明细模型
  9. #import "RepairReceiptDetailModel.h"
  10. @implementation RepairReceiptDetailModel
  11. /*!
  12. * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
  13. * 前:模型的属性 后:字典里的属性
  14. */
  15. + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
  16. return @{@"saleNo":@"SalesNo",
  17. @"receiptRemark":@"ReceiptRemarks",
  18. @"receiptType":@"ReceiptType",
  19. @"code":@"Code",
  20. @"onlyCode":@"OnlyCode",
  21. @"goodsName":@"GoodsName",
  22. @"brandName":@"BrandName",
  23. @"varietyName":@"VarietyName",
  24. @"seriesName":@"SeriesName",
  25. @"unitName":@"UnitName",
  26. @"decimalPlaces":@"DecimalPlaces",
  27. @"package":@"Package",
  28. @"colorNumber":@"ColorNumber",
  29. @"specification":@"Specification",
  30. @"warrantyDate":@"WarrantyDate",
  31. @"weight":@"Weight",
  32. @"acreage":@"Acreage",
  33. @"box":@"Box",
  34. @"piece":@"Piece",
  35. @"m2":@"M2",
  36. @"remarks":@"Remarks",
  37. @"expandAttribute":@"ExpandAttribute",
  38. @"expandAttributeTwo":@"ExpandAttribute2",
  39. };
  40. }
  41. /*!
  42. * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
  43. * NSDate *time dic[@"t"]是double类型的的秒数
  44. * Dic -> model
  45. */
  46. - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
  47. int decimalPlaces = [[dic objectForKey:@"DecimalPlaces"] intValue];
  48. NSString *str = [NSString stringWithFormat:@"%@%d%@",@"%.",decimalPlaces,@"f"];
  49. self.repairQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"RepairQuantity"]doubleValue]];
  50. self.receiptQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"ReceiptQuantity"]doubleValue]];
  51. self.completedQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"FinishQuantity"]doubleValue]];
  52. _receiptType = [NSString stringWithFormat:@"%ld",(long)[[dic objectForKey:@"ReceiptType"] integerValue]];
  53. return YES;
  54. }
  55. @end