using PdmSwPlugin.Common.Entity;
|
using PdmSwPlugin.PriceCheck.Param;
|
using System.Collections.ObjectModel;
|
|
namespace PdmSwPlugin.PriceCheck.Model
|
{
|
public class JgjModel : NotifyBase
|
{
|
public ModelProperty _modelProperty;
|
public ModelProperty ModelProperty
|
{
|
get => _modelProperty;
|
set => RaiseAndSetIfChanged(ref _modelProperty, value);
|
}
|
|
public JgjModel(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(heatFee, out double heat))
|
{
|
message = "请输入正确的表处理费";
|
return 0;
|
}
|
|
if (!double.TryParse(discount, out double dis))
|
{
|
message = "请输入正确的系数";
|
return 0;
|
}
|
return dis * (stuff + work + surface + heat);
|
}
|
}
|
|
public class StuffFeeModel : NotifyBase{
|
public ModelProperty _modelProperty;
|
public ModelProperty ModelProperty
|
{
|
get => _modelProperty;
|
set => RaiseAndSetIfChanged(ref _modelProperty, value);
|
}
|
|
public double Density => ModelProperty == null ? 0 : ModelProperty.density;
|
public double Weight => ModelProperty == null ? 0 : ModelProperty.weight;
|
|
private double _unitPrice;
|
public double UnitPrice
|
{
|
get => _unitPrice;
|
set => RaiseAndSetIfChanged(ref _unitPrice, value);
|
}
|
|
private double _price;
|
public double Price
|
{
|
get => _price;
|
set => RaiseAndSetIfChanged(ref _price, value);
|
}
|
}
|
}
|