修改已知问题
This commit is contained in:
@@ -49,6 +49,11 @@ namespace CapMachine.Model
|
||||
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 当前的步骤的时间
|
||||
///// </summary>
|
||||
//[Column(IsIgnore = true)]
|
||||
//public int ProSegTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
|
||||
@@ -56,5 +61,6 @@ namespace CapMachine.Model
|
||||
|
||||
public List<ProStep>? ProSteps { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,20 @@ namespace CapMachine.Wpf.ViewModels
|
||||
this.Mapper = mapper;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
|
||||
// 获取ProgramSeg的数据
|
||||
var workCondList = FreeSql.Select<ProgramSeg>()
|
||||
.ToList()
|
||||
.Select(g => g.Name)
|
||||
.ToList();
|
||||
|
||||
// 转换为CbxItems集合,都是文本内容
|
||||
WorkCondCbxItems = new ObservableCollection<CbxItems>(
|
||||
workCondList.Select(workCond => new CbxItems
|
||||
{
|
||||
Key = workCond,
|
||||
Text = workCond
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
public ConfigService ConfigService { get; }
|
||||
@@ -40,6 +54,16 @@ namespace CapMachine.Wpf.ViewModels
|
||||
public IFreeSql FreeSql { get; }
|
||||
public PPCService PPCService { get; }
|
||||
|
||||
private ObservableCollection<CbxItems> _WorkCondCbxItems;
|
||||
/// <summary>
|
||||
/// 供选择的工况集合信息
|
||||
/// </summary>
|
||||
public ObservableCollection<CbxItems> WorkCondCbxItems
|
||||
{
|
||||
get { return _WorkCondCbxItems; }
|
||||
set { _WorkCondCbxItems = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AutoMap映射
|
||||
/// </summary>
|
||||
|
||||
@@ -182,6 +182,8 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//新选择ProSeg后,此时还没有选择具体的速度等参数,需要禁用设置,等选择了具体的ProStep后再启用
|
||||
SpeedTabControlEnable = false;
|
||||
OtherParTabControlEnable = false;
|
||||
|
||||
SumProSegTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -214,6 +216,17 @@ namespace CapMachine.Wpf.ViewModels
|
||||
set { _SelectedProgramSeg = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private string _ProSegTime;
|
||||
/// <summary>
|
||||
/// 当前程序段的时间
|
||||
/// </summary>
|
||||
public string ProSegTime
|
||||
{
|
||||
get { return _ProSegTime; }
|
||||
set { _ProSegTime = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加载最新的数据
|
||||
/// </summary>
|
||||
@@ -432,7 +445,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
//获取全部的数据
|
||||
//RefreshProSeg();
|
||||
|
||||
MessageBox.Show("更新后请重新选中程序后,【总循环次数】和【总时间】将会正确显示", "数据更新", MessageBoxButton.OK, MessageBoxImage.Hand);
|
||||
}
|
||||
else if (par.Result == ButtonResult.Cancel)
|
||||
{
|
||||
@@ -2785,6 +2798,8 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
}
|
||||
|
||||
//更新后检测时间是否匹配并界面提示
|
||||
CheckSpeedSlopListTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -3182,6 +3197,8 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//新增时,总是在斜率中
|
||||
SelectedProStepDto.SpeedCycle!.IsSlop = true;
|
||||
SelectedProStepDto.SpeedCycle!.Cycle = SelectedProStepDto.SpeedCycle.Cycle;
|
||||
|
||||
SumProSegTime();
|
||||
//if (MeterSpeedExDto.TotalSlopTime != GetKeepTimeBySpeed())
|
||||
//{
|
||||
// MeterSpeedExDto.IsTimeOk = false;
|
||||
@@ -3192,6 +3209,73 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算程序段的总时间
|
||||
/// 按照速度为牟定参数
|
||||
/// </summary>
|
||||
public void SumProSegTime()
|
||||
{
|
||||
//更新程序段总时间,ProSeg
|
||||
if (SelectedProgramSeg != null && SelectedProgramSeg.ProSteps != null
|
||||
&& SelectedProgramSeg.ProSteps.Count() > 0)
|
||||
{
|
||||
var SegStepTime = 0;
|
||||
foreach (var itemProStep in SelectedProgramSeg.ProSteps)
|
||||
{
|
||||
if (itemProStep.MeterSpeeds != null && itemProStep.MeterSpeeds.Count()>0)
|
||||
{
|
||||
if (itemProStep.MeterSpeeds.FirstOrDefault()!.ValueType == ConfigValueType.Slope)
|
||||
{
|
||||
//带斜率
|
||||
var SegTimeCell = itemProStep.SpeedCycle * itemProStep.MeterSpeeds.Sum(a => a.KeepTime);
|
||||
SegStepTime = SegStepTime + SegTimeCell;
|
||||
}
|
||||
else
|
||||
{
|
||||
//常值数据
|
||||
SegStepTime = SegStepTime + itemProStep.MeterSpeeds.Sum(a => a.KeepTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SegStepTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ProSegTime = ConvertSecondsToTimeString(SegStepTime * SelectedProgramSeg.ProRepeat);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 秒数转时间字符串
|
||||
/// </summary>
|
||||
/// <param name="totalSeconds"></param>
|
||||
/// <returns></returns>
|
||||
public string ConvertSecondsToTimeString(int totalSeconds)
|
||||
{
|
||||
TimeSpan time = TimeSpan.FromSeconds(totalSeconds);
|
||||
List<string> parts = new List<string>();
|
||||
|
||||
if (time.Hours > 0)
|
||||
{
|
||||
parts.Add($"{time.Hours}小时");
|
||||
parts.Add($"{time.Minutes}分");
|
||||
parts.Add($"{time.Seconds}秒");
|
||||
}
|
||||
else if (time.Minutes > 0)
|
||||
{
|
||||
parts.Add($"{time.Minutes}分");
|
||||
parts.Add($"{time.Seconds}秒");
|
||||
}
|
||||
else
|
||||
{
|
||||
parts.Add($"{time.Seconds}秒");
|
||||
}
|
||||
|
||||
return string.Join("", parts);
|
||||
}
|
||||
|
||||
private string MeterSpeedToString(List<MeterSpeed> data)
|
||||
{
|
||||
var strInfo = new StringBuilder();
|
||||
|
||||
@@ -105,10 +105,34 @@
|
||||
Binding="{Binding Name}"
|
||||
Header="名称"
|
||||
IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" />
|
||||
<DataGridTextColumn
|
||||
|
||||
<DataGridTemplateColumn Header="实验工况" IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Text"
|
||||
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.WorkCondCbxItems}"
|
||||
SelectedValue="{Binding WorkCond, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Key">
|
||||
<ComboBox.Style>
|
||||
<Style BasedOn="{StaticResource MaterialDesignComboBox}" TargetType="ComboBox">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" Value="True">
|
||||
<Setter Property="IsEnabled" Value="False" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ComboBox.Style>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!--<DataGridTextColumn
|
||||
Binding="{Binding WorkCond}"
|
||||
Header="实验工况"
|
||||
IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" />
|
||||
IsReadOnly="{Binding Source={StaticResource Proxy}, Path=Data.IsComplete}" />-->
|
||||
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding ExpNo}"
|
||||
Header="实验编号"
|
||||
|
||||
@@ -379,6 +379,36 @@
|
||||
Text="{Binding SelectedProgramSeg.ProRepeat}"
|
||||
TextAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
<TextBlock
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="22"
|
||||
Foreground="Black"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="20"
|
||||
Text="总时间:" />
|
||||
<Border
|
||||
Margin="2"
|
||||
Background="LightSlateGray"
|
||||
BorderThickness="1"
|
||||
CornerRadius="3">
|
||||
<TextBox
|
||||
Width="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
BorderThickness="0"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding ProSegTime}"
|
||||
TextAlignment="Center" />
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
|
||||
@@ -52,5 +52,7 @@ namespace CapMachine.Wpf.Views
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user