예제 #1
0
        private void GoToPriceInputPageButton_Click(object sender, RoutedEventArgs e)
        {
            // Warn user if any field on left column is not clear but filled with value
            if (!AllInputFieldsClear())
            {
                string           sMessageBoxText = "左侧输入栏仍有值未保存,选择继续将丢失这些值,确定继续?";
                string           sCaption        = "输入栏有未保存值";
                MessageBoxButton btnMessageBox   = MessageBoxButton.YesNo;
                MessageBoxImage  icnMessageBox   = MessageBoxImage.Warning;
                MessageBoxResult rsltMessageBox  = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);

                switch (rsltMessageBox)
                {
                case MessageBoxResult.Yes:
                    break;

                case MessageBoxResult.No:
                    return;
                }
            }

            List <InputItem>  inputItemList  = inputItemOC.ToList();
            List <SummedItem> summedItemList = CalculationService.MergeInputItem(inputItemList);

            try
            {
                IOService.GenerateInputCheckingSheet(saveDirectoryPrefix + "-输入校对表" + AppConfigReadingService.GetSpreadSheetExtention(), inputItemList);

                PriceInputPage priceInputPage = new PriceInputPage(summedItemList, inputItemList, saveDirectoryPrefix);
                this.NavigationService.Navigate(priceInputPage);
            }
            catch (IOException ioex)
            {
                string           sMessageBoxText = "校对表生成失败,无法进入价格输入页面,请确认您已关闭所有报表";
                string           sCaption        = "无法进入价格输入页面";
                MessageBoxButton btnMessageBox   = MessageBoxButton.OK;
                MessageBoxImage  icnMessageBox   = MessageBoxImage.Error;
                MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);
            }
            catch (Exception ex)
            {
                string           sMessageBoxText = "因未知原因校对表生成失败,请联系软件商";
                string           sCaption        = "校对表生成失败";
                MessageBoxButton btnMessageBox   = MessageBoxButton.OK;
                MessageBoxImage  icnMessageBox   = MessageBoxImage.Error;
                MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);
            }
        }
예제 #2
0
        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");
        }
예제 #3
0
        private void SaveAndCloseButton_Click(object sender, RoutedEventArgs e)
        {
            // Warn user if any field on left column is not clear but filled with value
            if (!AllInputFieldsClear())
            {
                string           sMessageBoxText = "左侧输入栏仍有值未保存,选择继续将丢失这些值,确定继续?";
                string           sCaption        = "输入栏有未保存值";
                MessageBoxButton btnMessageBox   = MessageBoxButton.YesNo;
                MessageBoxImage  icnMessageBox   = MessageBoxImage.Warning;
                MessageBoxResult rsltMessageBox  = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);

                switch (rsltMessageBox)
                {
                case MessageBoxResult.Yes:
                    break;

                case MessageBoxResult.No:
                    return;
                }
            }

            try
            {
                IOService.GenerateInputCheckingSheet(saveDirectoryPrefix + "-输入校对表" + AppConfigReadingService.GetSpreadSheetExtention(), inputItemOC.ToList());

                Application.Current.Shutdown();
            }
            catch (IOException ioex)
            {
                string           sMessageBoxText = "进度保存失败,请确认您已关闭所有报表";
                string           sCaption        = "进度保存失败";
                MessageBoxButton btnMessageBox   = MessageBoxButton.OK;
                MessageBoxImage  icnMessageBox   = MessageBoxImage.Error;
                MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);
            }
            catch (Exception ex)
            {
                string           sMessageBoxText = "因未知原因进度保存失败,请联系软件商";
                string           sCaption        = "进度保存失败";
                MessageBoxButton btnMessageBox   = MessageBoxButton.OK;
                MessageBoxImage  icnMessageBox   = MessageBoxImage.Error;
                MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);
            }
        }