| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- //
- // InventoryCostModel.m
- // IBOSS
- //
- // Created by 关宏厚 on 2020/11/17.
- // Copyright © 2020 elongtian. All rights reserved.
- //
- #import "InventoryCostModel.h"
- @implementation InventoryCostModel
- /*!
- * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
- * 前:模型的属性 后:字典里的属性
- */
- + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
-
- return @{
- @"code":@"Code",
- @"codeId":@"CodeID",
- @"onlyCode":@"OnlyCode",
- @"wareHouseName":@"WarehouseName",
- @"goodName":@"GoodsName",
- @"specification":@"Specification",
- @"colorNumber":@"ColorNumber",
- @"brandName":@"BrandName",
- @"gradeName":@"GradeName",
- @"positionNumber":@"PositionNumber",
- @"inventoryQuantity":@"InventoryQuantity",
- @"costPrice":@"CostPrice",
- @"circulateType":@"CirculateType",
- @"package":@"Package",
- @"occupyQuantity":@"OccupyQuantity",
- @"decimalPlaces":@"DecimalPlaces",
- @"inventoryId":@"InventoryID",
- @"acreage":@"Acreage",
- @"specification":@"Specification",
- @"kindName":@"KindName",
- @"varietyName":@"VarietyName",
- @"inventoryAmount":@"InventoryAmount",
- @"seriesName":@"SeriesName",
- @"timelyCost":@"TimelyCost",
- @"inventoryTimelyAmount":@"InventoryTimelyAmount",
- @"lastInventoryQuantity":@"LastInventoryQuantity",
- @"lastInventoryAmount":@"LastInventoryAmount",
- @"thisInventoryAmount":@"ThisInventoryAmount",
- @"thisInventoryQuantity":@"ThisInventoryQuantity",
- @"balanceQuantity":@"BalanceQuantity",
- @"balanceAmount":@"BalanceAmount",
- @"lastCarryOverCost":@"LastCarryoverCost",
- @"occupyQuantityAmount":@"OccupyQuantityAmount",
- @"noDeliveryQuantity":@"NoDeliveryQuantity",
- @"noDeliveryQuantityAmount":@"NoDeliveryQuantityAmount",
- @"noBookOccupyQuantity":@"NoBookOccupyQuantity",
- @"noBookOccupyQuantityAmount":@"NoBookOccupyQuantityAmount",
- @"expandAttribute":@"ExpandAttribute",
- @"expandAttribute2":@"ExpandAttribute2",
- @"standardProcurementPrice":@"StandardProcurementPrice",
- @"goodsRemarks":@"GoodsRemarks"
-
- };
- }
- - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
- if(dic!=nil){
- int inventoryIdValue=[[dic objectForKey:@"InventoryID"]intValue];
- _inventoryId=[NSString stringWithFormat:@"%d",inventoryIdValue];
-
- int decimalPlacesValue=[[dic objectForKey:@"DecimalPlaces"]intValue];
- double lastInventoryQuantityValue=[[dic objectForKey:@"InventoryID"]doubleValue];
- double thisInventoryQuantityValue=[[dic objectForKey:@"ThisInventoryQuantity"]doubleValue];
-
- double balanceQuantityValue=[[dic objectForKey:@"BalanceQuantity"]doubleValue];
-
- double noDeliveryQuantityValue=[[dic objectForKey:@"NoDeliveryQuantity"]doubleValue];
-
- double noBookOccupyQuantityValue=[[dic objectForKey:@"NoBookOccupyQuantity"]doubleValue];
-
- double inventoryQuantityValue=[[dic objectForKey:@"InventoryQuantity"]doubleValue];
-
- NSString* decimalFormat = [NSString stringWithFormat:@"%@%d%@",@"%.",decimalPlacesValue,@"f" ];
- _lastInventoryQuantity=[NSString stringWithFormat:decimalFormat,lastInventoryQuantityValue];
-
- _thisInventoryQuantity=[NSString stringWithFormat:decimalFormat,thisInventoryQuantityValue];
- _balanceQuantity=[NSString stringWithFormat:decimalFormat,balanceQuantityValue];
-
- _noDeliveryQuantity=[NSString stringWithFormat:decimalFormat,noDeliveryQuantityValue];
-
- _noBookOccupyQuantity=[NSString stringWithFormat:decimalFormat,noBookOccupyQuantityValue];
- _inventoryQuantity=[NSString stringWithFormat:decimalFormat,inventoryQuantityValue];
-
- double costPriceValue=[[dic objectForKey:@"CostPrice"]doubleValue];
- _costPrice=[NSString stringWithFormat:@"¥%.2f",costPriceValue];
- double inventoryAmount=[[dic objectForKey:@"InventoryAmount"]doubleValue];
- _inventoryAmount=[NSString stringWithFormat:@"¥%.2f",inventoryAmount];
- double timelyCostValue=[[dic objectForKey:@"TimelyCost"]doubleValue];
- _timelyCost=[NSString stringWithFormat:@"¥%.2f",timelyCostValue];
- double inventoryTimelyAmountValue=[[dic objectForKey:@"InventoryTimelyAmount"]doubleValue];
- _inventoryTimelyAmount=[NSString stringWithFormat:@"¥%.2f",inventoryTimelyAmountValue];
- double lastInventoryAmountValue=[[dic objectForKey:@"LastInventoryAmount"]doubleValue];
- _lastInventoryAmount=[NSString stringWithFormat:@"¥%.2f",lastInventoryAmountValue];
- double thisInventoryAmountValue=[[dic objectForKey:@"ThisInventoryAmount"]doubleValue];
- _thisInventoryAmount=[NSString stringWithFormat:@"¥%.2f",thisInventoryAmountValue];
-
- double balanceAmountValue=[[dic objectForKey:@"BalanceAmount"]doubleValue];
- _balanceAmount=[NSString stringWithFormat:@"¥%.2f",balanceAmountValue];
- double occupyQuantityAmountValue=[[dic objectForKey:@"OccupyQuantityAmount"]doubleValue];
- _occupyQuantityAmount=[NSString stringWithFormat:@"¥%.2f",occupyQuantityAmountValue];
- double noDeliveryQuantityAmountValue=[[dic objectForKey:@"NoDeliveryQuantityAmount"]doubleValue];
- _noDeliveryQuantityAmount=[NSString stringWithFormat:@"¥%.2f",noDeliveryQuantityAmountValue];
- double noBookOccupyQuantityAmountValue=[[dic objectForKey:@"NoBookOccupyQuantityAmount"]doubleValue];
- _noBookOccupyQuantityAmount=[NSString stringWithFormat:@"¥%.2f",noBookOccupyQuantityAmountValue];
- double standardProcurementPriceValue=[[dic objectForKey:@"StandardProcurementPrice"]doubleValue];
- _standardProcurementPrice=[NSString stringWithFormat:@"¥%.2f",standardProcurementPriceValue];
- }
-
- return YES;
- }
- @end
|