修改已知问题
This commit is contained in:
@@ -16,7 +16,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// </summary>
|
||||
public class DialogExpInfoViewModel : DialogViewModel
|
||||
{
|
||||
public DialogExpInfoViewModel(ConfigService configService, IFreeSql freeSql,PPCService pPCService, IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
public DialogExpInfoViewModel(ConfigService configService, IFreeSql freeSql, PPCService pPCService, IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
{
|
||||
this.Title = "试验信息拓展设置";
|
||||
ConfigService = configService;
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user