|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Text; |
| 4 | +using FikaAmazonAPI.ReportGeneration.ReportDataTable; |
| 5 | + |
| 6 | +namespace FikaAmazonAPI.ReportGeneration |
| 7 | +{ |
| 8 | + public class InventoryPlanningDataReport |
| 9 | + { |
| 10 | + public List<InventoryPlanningDataRow> Data { get; set; } = new List<InventoryPlanningDataRow>(); |
| 11 | + public InventoryPlanningDataReport(string path, string refNumber) |
| 12 | + { |
| 13 | + if (string.IsNullOrEmpty(path)) |
| 14 | + return; |
| 15 | + |
| 16 | + var table = Table.ConvertFromCSV(path); |
| 17 | + |
| 18 | + List<InventoryPlanningDataRow> values = new List<InventoryPlanningDataRow>(); |
| 19 | + foreach (var row in table.Rows) |
| 20 | + { |
| 21 | + values.Add(InventoryPlanningDataRow.FromRow(row, refNumber)); |
| 22 | + } |
| 23 | + Data = values; |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | + public class InventoryPlanningDataRow |
| 28 | + { |
| 29 | + public DateTime? SnapshotDate { get; set; } |
| 30 | + public string SKU { get; set; } |
| 31 | + public string FNSKU { get; set; } |
| 32 | + public string ASIN { get; set; } |
| 33 | + public string ProductName { get; set; } |
| 34 | + public string Condition { get; set; } |
| 35 | + public int? Avaliable { get; set; } |
| 36 | + public int? PendingRemovalQuantity { get; set; } |
| 37 | + public int? InvAge181To330Days { get; set; } |
| 38 | + public int? InvAge331To365Days { get; set; } |
| 39 | + public int? InvAge61To90Days { get; set; } |
| 40 | + public int? InvAge31To60Days { get; set; } |
| 41 | + public int? InvAge0To30Days { get; set; } |
| 42 | + public int? InvAge0To90Days { get; set; } |
| 43 | + public int? InvAge91To180Days { get; set; } |
| 44 | + public int? InvAge181To270Days { get; set; } |
| 45 | + public int? InvAge271To365Days { get; set; } |
| 46 | + public int? InvAge365PlusDays { get; set; } |
| 47 | + public string Currency { get; set; } |
| 48 | + public int? QtyToBeChargedLtsf11Mo { get; set; } |
| 49 | + public int? QtyToBeChargedLtsf12Mo { get; set; } |
| 50 | + public decimal? ProjectedLtsf11Mo { get; set; } |
| 51 | + public decimal? EstimatedLtsfNextCharge { get; set; } |
| 52 | + public int? UnitsShippedT7 { get; set; } |
| 53 | + public int? UnitsShippedT30 { get; set; } |
| 54 | + public int? UnitsShippedT60 { get; set; } |
| 55 | + public int? UnitsShippedT90 { get; set; } |
| 56 | + public string Alert { get; set; } |
| 57 | + public decimal? YourPrice { get; set; } |
| 58 | + public decimal? SalesPrice { get; set; } |
| 59 | + public decimal? LowestPriceNewPlusShipping { get; set; } |
| 60 | + public decimal? LowestPriceUsed { get; set; } |
| 61 | + public string RecommendedAction { get; set; } |
| 62 | + public decimal? FeaturedofferPrice { get; set; } |
| 63 | + public int? WeeksOfCoverT90 { get; set; } |
| 64 | + public int? WeeksOfCoverT30 { get; set; } |
| 65 | + public int? EstimatedExcessQuantity { get; set; } |
| 66 | + public int? DaysOfSupply { get; set; } |
| 67 | + public int? SalesRank { get; set; } |
| 68 | + public string ProductGroup { get; set; } |
| 69 | + public double? StorageVolume { get; set; } |
| 70 | + public string StorageType { get; set; } |
| 71 | + public string VolumeUnitMeasurement { get; set; } |
| 72 | + public double? ItemVolume { get; set; } |
| 73 | + public decimal? SellThrough { get; set; } |
| 74 | + public decimal? EstimatedCostSavingsOfRecommendedActions { get; set; } |
| 75 | + public decimal? SalesShippedLast7Days { get; set; } |
| 76 | + public decimal? SalesShippedLast30Days { get; set; } |
| 77 | + public decimal? SalesShippedLast60Days { get; set; } |
| 78 | + public decimal? SalesShippedLast90Days { get; set; } |
| 79 | + public decimal? EstimatedStorageCostNextMonth { get; set; } |
| 80 | + public int? InboundQuantity { get; set; } |
| 81 | + public int? InboundWorking { get; set; } |
| 82 | + public int? InboundShipped { get; set; } |
| 83 | + public int? InboundReceived { get; set; } |
| 84 | + public int? ReservedQuantity { get; set; } |
| 85 | + public string NoSaleLast6Months { get; set; } |
| 86 | + public int? UnfulfillableQuantity { get; set; } |
| 87 | + public int? RecommendedRemovalQuantity { get; set; } |
| 88 | + public int? RecommendedSaleDuartionDays { get; set; } |
| 89 | + public decimal? RecommendedSalesPrice { get; set; } |
| 90 | + public int? HealthyInventoryLevel { get; set; } |
| 91 | + public string refNumber { get; set; } |
| 92 | + |
| 93 | + public static InventoryPlanningDataRow FromRow(TableRow rowData, string refNumber) |
| 94 | + { |
| 95 | + var row = new InventoryPlanningDataRow(); |
| 96 | + row.SnapshotDate = DataConverter.GetDate(rowData.GetString("snapshot-date"), DataConverter.DateTimeFormat.DATE_AGING_FORMAT); |
| 97 | + row.SKU = rowData.GetString("sku"); |
| 98 | + row.FNSKU = rowData.GetString("fnsku"); |
| 99 | + row.ASIN = rowData.GetString("asin"); |
| 100 | + row.ProductName = rowData.GetString("product-name"); |
| 101 | + row.Condition = rowData.GetString("condition"); |
| 102 | + row.Avaliable= DataConverter.GetInt(rowData.GetString("avaliable")); |
| 103 | + row.PendingRemovalQuantity = DataConverter.GetInt(rowData.GetString("pending-removal-quantity")); |
| 104 | + row.InvAge0To90Days = DataConverter.GetInt(rowData.GetString("inv-age-0-to-90-days")); |
| 105 | + row.InvAge91To180Days = DataConverter.GetInt(rowData.GetString("inv-age-91-to-180-days")); |
| 106 | + row.InvAge181To270Days = DataConverter.GetInt(rowData.GetString("inv-age-181-to-270-days")); |
| 107 | + row.InvAge271To365Days = DataConverter.GetInt(rowData.GetString("inv-age-271-to-365-days")); |
| 108 | + row.InvAge365PlusDays = DataConverter.GetInt(rowData.GetString("inv-age-365-plus-days")); |
| 109 | + row.Currency = rowData.GetString("currency"); |
| 110 | + row.QtyToBeChargedLtsf12Mo = DataConverter.GetInt(rowData.GetString("qty-to-be-charged-ltsf-12-mo")); |
| 111 | + row.QtyToBeChargedLtsf11Mo = DataConverter.GetInt(rowData.GetString("qty-to-be-charged-ltsf-11-mo")); |
| 112 | + row.ProjectedLtsf11Mo = DataConverter.GetInt(rowData.GetString("projected-ltsf-11-mo")); |
| 113 | + row.EstimatedLtsfNextCharge = DataConverter.GetInt(rowData.GetString("estimated-ltsf-next-charge")); |
| 114 | + row.UnitsShippedT7 = DataConverter.GetInt(rowData.GetString("units-shipped-t7")); |
| 115 | + row.UnitsShippedT30 = DataConverter.GetInt(rowData.GetString("units-shipped-t30")); |
| 116 | + row.UnitsShippedT60 = DataConverter.GetInt(rowData.GetString("units-shipped-t60")); |
| 117 | + row.UnitsShippedT90 = DataConverter.GetInt(rowData.GetString("units-shipped-t90")); |
| 118 | + row.Alert = rowData.GetString("alert"); |
| 119 | + row.YourPrice = DataConverter.GetDecimal(rowData.GetString("your-price")); |
| 120 | + row.SalesPrice = DataConverter.GetDecimal(rowData.GetString("sales-price")); |
| 121 | + row.LowestPriceNewPlusShipping = DataConverter.GetDecimal(rowData.GetString("lowest-price-new-plus-shipping")); |
| 122 | + row.LowestPriceUsed = DataConverter.GetDecimal(rowData.GetString("lowest-price-used")); |
| 123 | + row.RecommendedAction = rowData.GetString("recommended-action"); |
| 124 | + row.HealthyInventoryLevel = DataConverter.GetInt(rowData.GetString("healthy-inventory-level")); |
| 125 | + row.RecommendedSalesPrice = DataConverter.GetDecimal(rowData.GetString("recommended-sales-price")); |
| 126 | + row.RecommendedSaleDuartionDays = DataConverter.GetInt(rowData.GetString("recommended-sale-duration-days")); |
| 127 | + row.RecommendedRemovalQuantity = DataConverter.GetInt(rowData.GetString("recommended-removal-quantity")); |
| 128 | + row.EstimatedCostSavingsOfRecommendedActions = DataConverter.GetDecimal(rowData.GetString("estimated-cost-savings-of-recommended-actions")); |
| 129 | + row.SellThrough = DataConverter.GetDecimal(rowData.GetString("sell-through")); |
| 130 | + row.ItemVolume = DataConverter.GetDouble(rowData.GetString("item-volume")); |
| 131 | + row.VolumeUnitMeasurement = rowData.GetString("volume-unit-measurement"); |
| 132 | + row.StorageType = rowData.GetString("storage-type"); |
| 133 | + row.StorageVolume = DataConverter.GetDouble(rowData.GetString("storage-volume")); |
| 134 | + row.StorageType = rowData.GetString("marketplace"); |
| 135 | + row.ProductGroup = rowData.GetString("product-group"); |
| 136 | + row.SalesRank = DataConverter.GetInt(rowData.GetString("sales-rank")); |
| 137 | + row.DaysOfSupply = DataConverter.GetInt(rowData.GetString("days-of-supply")); |
| 138 | + row.EstimatedExcessQuantity = DataConverter.GetInt(rowData.GetString("estimated-excess-quantity")); |
| 139 | + row.WeeksOfCoverT30 = DataConverter.GetInt(rowData.GetString("weeks-of-cover-t30")); |
| 140 | + row.WeeksOfCoverT90 = DataConverter.GetInt(rowData.GetString("weeks-of-cover-t90")); |
| 141 | + row.FeaturedofferPrice = DataConverter.GetDecimal(rowData.GetString("featuredoffer-price")); |
| 142 | + row.SalesShippedLast7Days = DataConverter.GetDecimal(rowData.GetString("sales-shipped-last-7-days")); |
| 143 | + row.SalesShippedLast30Days = DataConverter.GetDecimal(rowData.GetString("sales-shipped-last-30-days")); |
| 144 | + row.SalesShippedLast60Days = DataConverter.GetDecimal(rowData.GetString("sales-shipped-last-60-days")); |
| 145 | + row.SalesShippedLast90Days = DataConverter.GetDecimal(rowData.GetString("sales-shipped-last-90-days")); |
| 146 | + row.InvAge0To30Days = DataConverter.GetInt(rowData.GetString("inv-age-0-to-30-days")); |
| 147 | + row.InvAge31To60Days = DataConverter.GetInt(rowData.GetString("inv-age-31-to-60-days")); |
| 148 | + row.InvAge61To90Days = DataConverter.GetInt(rowData.GetString("inv-age-61-to-90-days")); |
| 149 | + row.InvAge181To330Days = DataConverter.GetInt(rowData.GetString("inv-age-181-to-330-days")); |
| 150 | + row.InvAge331To365Days = DataConverter.GetInt(rowData.GetString("inv-age-331-to-365-days")); |
| 151 | + row.EstimatedStorageCostNextMonth = DataConverter.GetDecimal(rowData.GetString("estimated-storage-cost-next-month")); |
| 152 | + row.InboundQuantity = DataConverter.GetInt(rowData.GetString("inbound-quantity")); |
| 153 | + row.InboundWorking = DataConverter.GetInt(rowData.GetString("inbound-working")); |
| 154 | + row.InboundShipped = DataConverter.GetInt(rowData.GetString("inbound-shipped")); |
| 155 | + row.InboundReceived = DataConverter.GetInt(rowData.GetString("inbound-received")); |
| 156 | + row.NoSaleLast6Months = rowData.GetString("no-sale-last-6-months"); |
| 157 | + row.ReservedQuantity = DataConverter.GetInt(rowData.GetString("reserved-quantity")); |
| 158 | + row.UnfulfillableQuantity = DataConverter.GetInt(rowData.GetString("unfulfillable-quantity")); |
| 159 | + row.refNumber = refNumber; |
| 160 | + return row; |
| 161 | + } |
| 162 | + |
| 163 | + } |
| 164 | +} |
0 commit comments