| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- //
- // DeliveryListDetailModel.m
- // IBOSS
- //
- // Created by Dongke on 16/1/12.
- // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
- //
- // 功能描述:配送回执明细模型
- #import "DeliveryListDetailModel.h"
- @implementation DeliveryListDetailModel
- #pragma mark - 公有函数
- /*!
- * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
- * 前:模型的属性 后:字典里的属性
- */
- + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
-
- return @{@"detailId":@"DetailID",
- @"deliveryId":@"DeliveryID",
- @"sourceFromName":@"SourceFromName",
- @"sourceFrom":@"SourceFrom",
- @"invoiceNo":@"InvoiceNo",
- @"invoiceId":@"InvoiceID",
- @"invoiceDetailId":@"InvoiceDetailID",
- @"deliveryQuantity":@"DeliveryQuantity",
- @"outQuantity":@"OutQuantity",
- @"receiptQuantity":@"ReceiptQuantity",
- @"receiptRemarks":@"ReceiptRemarks",
- @"receiptType":@"ReceiptType",
- @"code":@"Code",
- @"onlyCode":@"OnlyCode",
- @"goodsName":@"GoodsName",
- @"expandAttribute":@"ExpandAttribute",
- @"expandAttribute2":@"ExpandAttribute2",
- @"brandName":@"BrandName",
- @"kindName":@"KindName",
- @"kindName":@"KindName",
- @"varietyName":@"VarietyName",
- @"seriesName":@"SeriesName",
- @"unitName":@"UnitName",
- @"decimalPlaces":@"DecimalPlaces",
- @"package":@"Package",
- @"weight":@"Weight",
- @"acreage":@"Acreage",
- @"gradeName":@"GradeName",
- @"specification":@"Specification",
- @"colorNumber":@"ColorNumber",
- @"warehouseName":@"WarehouseName",
- @"positionNumber":@"PositionNumber",
- @"salesDetailType":@"SalesDetailType"
- };
- }
- /*!
- * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
- * NSDate *time dic[@"t"]是double类型的的秒数
- */
- - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
- int decimalPlaces = [[dic objectForKey:@"DecimalPlaces"] intValue];
- NSString *str = [NSString stringWithFormat:@"%@%d%@",@"%.",decimalPlaces,@"f"];
- self.detailId = [[dic objectForKey:@"DetailID"] stringValue];
- self.deliveryId = [[dic objectForKey:@"DeliveryID"]stringValue];
- if([dic objectForKey:@"SourceFrom"]){
- self.sourceFrom = [[dic objectForKey:@"SourceFrom"] stringValue];
- }else{
- self.sourceFrom = @"";
- }
-
- if([dic objectForKey:@"InvoiceID"]){
- self.invoiceId = [[dic objectForKey:@"InvoiceID"] stringValue];
- }else{
- self.invoiceId = @"";
- }
-
- self.invoiceDetailId = [[dic objectForKey:@"InvoiceDetailID"] stringValue];
- if([dic objectForKey:@"DeliveryQuantity"]){
- self.deliveryQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"DeliveryQuantity"] doubleValue]];
- }else{
- self.deliveryQuantity = @"";
-
- }
-
- if([dic objectForKey:@"OutQuantity"]){
- self.outQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"OutQuantity"] doubleValue]];
- }else{
- self.outQuantity = @"";
- }
- if([dic objectForKey:@"ReceiptQuantity"]){
- self.receiptQuantity = [NSString stringWithFormat:str,[[dic objectForKey:@"ReceiptQuantity"] doubleValue]];
- }else{
- self.receiptQuantity = @"";
- }
-
- self.receiptType = [[dic objectForKey:@"ReceiptType"] stringValue];
-
- self.decimalPlaces = [[dic objectForKey:@"DecimalPlaces"] stringValue];
- if([dic objectForKey:@"Package"]){
- self.package = [[dic objectForKey:@"Package"] stringValue];
- }else{
- self.package = @"";
- }
- if([dic objectForKey:@"Weight"]){
- self.weight = [[dic objectForKey:@"Weight"] stringValue];
- }else{
- self.weight = @"";
- }
- if([dic objectForKey:@"Acreage"]){
- self.acreage = [[dic objectForKey:@"Acreage"] stringValue];
- }else{
- self.acreage = @"";
- }
- if([dic objectForKey:@"SalesDetailType"]){
- self.salesDetailType = [[dic objectForKey:@"SalesDetailType"] stringValue];
- }else{
- self.salesDetailType = @"";
- }
-
-
-
-
- return YES;
- }
- /**
- model -> Dic
- @param dic <#dic description#>
- @return <#return value description#>
- */
- - (BOOL)modelCustomTransformToDictionary:(NSMutableDictionary *)dic {
- //dic[@"t"] = @([self.time timeIntervalSince1970] * 1000).description;
- return YES;
- }
- @end
|