Exemplo n.º 1
0
        private void CalTotalPrice()
        {
            decimal total = 0;

            if (decimal.TryParse(txtOtherFee.Text.Trim(), out decimal d))
            {
                total = TOTAL_PRICE + d;
            }
            else
            {
                total = TOTAL_PRICE;
            }
            txtPrice.Text = total.ToString();
            labPrice.Text = ExtendMethod.MoneyToCap(total);
        }
Exemplo n.º 2
0
        private void ExplainText(string s)
        {
            if (!WinVisible)
            {
                return;
            }

            ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
            {
                Clear();
                ControlHelper.ThreadRunExt(AppHelper.MainForm, () =>
                {
                    FeeTools feeTools = new FeeTools();
                    _carInfo          = new CarInfo();
                    _carInfo.TestNo   = RegexVal(s, @"检验流水号:(.*)号牌号码");
                    _carInfo.PlateNo  = RegexVal(s, @"号牌号码:(.*)车辆类型");
                    _carInfo.CarType  = RegexVal(s, @"车辆类型:(.*)检测项目");
                    _carInfo.TestItem = RegexVal(s, @"检测项目:(.*)检测次数");
                    string testTimes  = RegexVal(s, @"检测次数:(.*)引车员");
                    _carInfo.Guider   = RegexVal(s, @"引车员:(.*)检测时间");
                    _carInfo.TestDate = RegexVal(s, @"检测时间:(.*)");
                    ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                    {
                        //处理检验项目和检验次数
                        string[] testItems = _carInfo.TestItem.Split(',');
                        for (int i = 0; i < testItems.Length; i++)
                        {
                            int times     = RegexVal(testTimes, $@"{testItems[i]}(.*?)次").ToInt();
                            decimal price = CalPrice(feeTools, testItems[i].Trim(), times);
                            ItemList.Add(new Tuple <string, int, decimal>(testItems[i].ToString(), times, price));
                            var item = new ListViewItem(new string[] { testItems[i], times.ToString(), price.ToString() });
                            materialListView1.Items.Add(item);
                        }


                        foreach (var item in ItemList)
                        {
                            TOTAL_PRICE += item.Item3;
                        }
                        _carInfo.Price = TOTAL_PRICE;
                        carFiller.DisplayEntity(_carInfo);
                        labPrice.Text = ExtendMethod.MoneyToCap(TOTAL_PRICE);
                    });
                }, null, AppHelper.MainForm, true, "", 200);
            });
        }