chr
2024-10-09 1f645778ae80a3a8801b8bb4d0fcf8feb244ad43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using PdmSwPlugin.Common.Entity;
using PdmSwPlugin.PriceCheck.Param;
using System.Collections.ObjectModel;
 
namespace PdmSwPlugin.PriceCheck.Model
{
    public class TaibanModel : NotifyBase
    {
        public ModelProperty _modelProperty;
        public ModelProperty ModelProperty
        {
            get => _modelProperty;
            set => RaiseAndSetIfChanged(ref _modelProperty, value);
        }
 
        public TaibanModel(ModelProperty modelProperty)
        {
            ModelProperty = modelProperty;
            PropertyGrid.Add(ModelProperty);
        }
 
        private string _stuffFee;
        public string stuffFee
        {
            get => _stuffFee;
            set
            {
                RaiseAndSetIfChanged(ref _stuffFee, value);
                price = CountTotal(out string _).ToString();
            }
        }
 
        private string _workFee;
        public string workFee
        {
            get => _workFee;
            set
            {
                RaiseAndSetIfChanged(ref _workFee, value);
                price = CountTotal(out string _).ToString();
            }
        }
 
        private string _surfaceFee;
        public string surfaceFee
        {
            get => _surfaceFee;
            set
            {
                RaiseAndSetIfChanged(ref _surfaceFee, value);
                price = CountTotal(out string _).ToString();
            }
        }
 
        //private string _heatFee;
        //public string heatFee
        //{
        //    get => _heatFee;
        //    set
        //    {
        //        RaiseAndSetIfChanged(ref _heatFee, value);
        //        price = CountTotal(out string _).ToString();
        //    }
        //}
 
        private string _discount = "1";
        public string discount
        {
            get => _discount;
            set
            {
                RaiseAndSetIfChanged(ref _discount, value);
                price = CountTotal(out string _).ToString();
            }
        }
 
        private string _price;
        public string price
        {
            get => _price;
            set => RaiseAndSetIfChanged(ref _price, value);
        }
 
 
 
        private ObservableCollection<ModelProperty> _propertyGrid = new ObservableCollection<ModelProperty>();
        public ObservableCollection<ModelProperty> PropertyGrid
        {
            get => _propertyGrid;
            set => RaiseAndSetIfChanged(ref _propertyGrid, value);
        }
 
        private ObservableCollection<TechProcess> _processGrid = new ObservableCollection<TechProcess>();
        public ObservableCollection<TechProcess> ProcessGrid
        {
            get => _processGrid;
            set => RaiseAndSetIfChanged(ref _processGrid, value);
        }
 
        public double CountTotal(out string message)
        {
            message = null;
            if (!double.TryParse(stuffFee, out double stuff))
            {
                message = "请输入正确的材料费";
                return 0;
            }
            if (!double.TryParse(workFee, out double work))
            {
                message = "请输入正确的加工费";
                return 0;
            }
 
            if (!double.TryParse(surfaceFee, out double surface))
            {
                message = "请输入正确的表处理费";
                return 0;
            }
 
            if (!double.TryParse(discount, out double dis))
            {
                message = "请输入正确的系数";
                return 0;
            }
            return dis * (stuff + work + surface);
        }
    }
}