| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // RepairReceiptDetailModel.m
- // IBOSS
- //
- // Created by guan hong hou on 2017/8/1.
- // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
- //
- //功能描述:维修回执明细模型
- #import "RepairReceiptDetailModel.h"
- @implementation RepairReceiptDetailModel
- /*!
- * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
- * 前:模型的属性 后:字典里的属性
- */
- + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
-
- return @{@"saleNo":@"SalesNo",
- @"receiptRemark":@"ReceiptRemarks",
- @"receiptType":@"ReceiptType",
- @"code":@"Code",
- @"onlyCode":@"OnlyCode",
- @"goodsName":@"GoodsName",
- @"brandName":@"BrandName",
- @"varietyName":@"VarietyName",
- @"seriesName":@"SeriesName",
- @"unitName":@"UnitName",
- @"decimalPlaces":@"DecimalPlaces",
- @"package":@"Package",
- @"colorNumber":@"ColorNumber",
- @"specification":@"Specification",
- @"warrantyDate":@"WarrantyDate",
- @"weight":@"Weight",
- @"acreage":@"Acreage",
- @"box":@"Box",
- @"piece":@"Piece",
- @"m2":@"M2",
- @"remarks":@"Remarks",
- @"expandAttribute":@"ExpandAttribute",
- @"expandAttributeTwo":@"ExpandAttribute2",
- };
-
- }
- /*!
- * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
- * NSDate *time dic[@"t"]是double类型的的秒数
- * Dic -> model
- */
- - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
- int decimalPlaces = [[dic objectForKey:@"DecimalPlaces"] intValue];
- NSString *str = [NSString stringWithFormat:@"%@%d%@",@"%.",decimalPlaces,@"f"];
- self.repairQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"RepairQuantity"]doubleValue]];
- self.receiptQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"ReceiptQuantity"]doubleValue]];
- self.completedQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"FinishQuantity"]doubleValue]];
- _receiptType = [NSString stringWithFormat:@"%ld",(long)[[dic objectForKey:@"ReceiptType"] integerValue]];
- return YES;
- }
- @end
|