public PriceInputPage(List <SummedItem> summedItemList, List <InputItem> inputItemList, string saveDirectoryPrefix) { InitializeComponent(); this.summedItemList = summedItemList; this.inputItemList = inputItemList; this.saveDirectoryPrefix = saveDirectoryPrefix; this.needBuckle = NeedBuckleItem(this.summedItemList); if (this.needBuckle) { buckleItem = new BuckleItem(); buckleItem.Quantity = CalculationService.CalculateBuckleItemQuantity(summedItemList); buckleSection.Visibility = Visibility.Visible; } else { buckleItem = null; buckleSection.Visibility = Visibility.Collapsed; } this.priceCollectorList = CalculationService.SummedItemsToPriceCollectors(summedItemList); this.priceCollectorList.Sort(new PriceCollectorComparer()); DataContext = this; }
private void Testing2() { List <InputItem> inputItemList = new List <InputItem>(); inputItemList.Add(new InputItem("s-802锦绣纹", "b", "300*3600", "2+4", "顶", "东南卧室", "0.9", "东西铺贴")); inputItemList.Add(new InputItem("s-802锦绣纹", "b", "400*3600", "5.9+4.7", "顶", "南西卧室", "3.6", "南北铺贴")); inputItemList.Add(new InputItem("s-803锦绣纹", "b", "300*3600", "5.9+4.7", "顶", "南西卧室", "3.6", "南北铺贴")); inputItemList.Add(new InputItem("s-802锦绣纹", "b", "300*3600", "5.9+4.7", "顶", "南西卧室", "3.6", "南北铺贴")); inputItemList.Add(new InputItem("s-802锦绣纹", "b", "300*800", "5.9+4.7", "顶", "南西卧室", "0.2", "南北铺贴")); inputItemList.Add(new InputItem("s-603金橡木", "x", "100*3000", "5.9+4.7+5.9+4.7", "踢脚线", "南西卧室")); inputItemList.Add(new InputItem("s-603金橡木", "x", "100*3000", "5.8", "踢脚线", "北卧室")); inputItemList.Add(new InputItem("s-802锦绣纹", "b", "400*800", "5.9+4.7", "顶", "南西卧室", "0.2", "南北铺贴")); List <SummedItem> summedItemList = CalculationService.MergeInputItem(inputItemList); foreach (SummedItem item in summedItemList) { item.BuyPrice = "15"; item.SellPrice = "20"; double buyPrice = StringParserService.ParsePrice(item.BuyPrice); double sellPrice = StringParserService.ParsePrice(item.SellPrice); //TODO: figure out why 15 * 46.66 gives you 656.5999999991 only here but not in csharpplayground item.TotalBuyPrice = CalculationService.CalculateTotalPricesByAreaOrLength(buyPrice, item.TotalAreaOrLength); item.TotalSellPrice = CalculationService.CalculateTotalPricesByAreaOrLength(sellPrice, item.TotalAreaOrLength); } BuckleItem buckleItem = new BuckleItem(); buckleItem.Quantity = CalculationService.CalculateBuckleItemQuantity(summedItemList); buckleItem.BuyPrice = "1"; buckleItem.SellPrice = "1.5"; double buckleBuyPrice = StringParserService.ParsePrice(buckleItem.BuyPrice); double buckleSellPrice = StringParserService.ParsePrice(buckleItem.SellPrice); buckleItem.TotalBuyPrice = CalculationService.CalculateTotalPricesByQuantity(buckleBuyPrice, buckleItem.Quantity); buckleItem.TotalSellPrice = CalculationService.CalculateTotalPricesByQuantity(buckleSellPrice, buckleItem.Quantity); IOService.GenerateInputCheckingSheet(@"C:\Users\JZhang\Desktop\输入校对表.xlsx", inputItemList); IOService.GenerateConstructionDetailSheet(@"C:\Users\JZhang\Desktop\施工详单.xlsx", inputItemList); IOService.GenerateMaterialTotalSheet(@"C:\Users\JZhang\Desktop\材料清单1.xlsx", summedItemList, buckleItem, true); IOService.GenerateMaterialTotalSheet(@"C:\Users\JZhang\Desktop\材料清单2.xlsx", summedItemList, buckleItem, false); List <InputItem> readInput = IOService.ReadInputCheckingSheetToInputItemList(@"C:\Users\JZhang\Desktop\输入校对表.xlsx"); }