You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.9 KiB
C#

1 year ago
using Khd.Core.Domain.Models;
1 year ago
using Khd.Core.Wpf.dto;
1 year ago
using System;
2 years ago
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
1 year ago
using System.Windows;
using System.Windows.Controls;
2 years ago
using System.Windows.Data;
1 year ago
using System.Windows.Media;
2 years ago
namespace Khd.Core.Wpf.myConverter
{
[ValueConversion(typeof(int), typeof(string))]
public class AgvTaskStatusConverter : IValueConverter
{
1 year ago
private readonly Dictionary<long?, Dictionary<int?, string>> dic = new()
2 years ago
{
1 year ago
{2,
new Dictionary<int?,string>(){
{-1,"人工创建" },
{0,"未下发" },
{1,"已下发" },
{2,"任务开始" },
{3,"已到起始地" },
{4,"起始地继续任务" },
{5,"已到目的地" },
{6,"任务结束" },
}
},
{
4,
new Dictionary<int?, string>(){
{-1,"人工创建" },
{0,"未下发" },
{1,"已下发" },
{2,"已开始" },
{3,"已到达起始地" },
{4,"起始地继续任务" },
{5,"已到达目的地" },
1 year ago
{6,"任务结束" }
1 year ago
}
},
{
5,
new Dictionary<int?, string>(){
{-1,"人工创建" },
{0,"未下发" },
{1,"已下发" },
{2,"已开始" },
{3,"已到达起始地" },
{4,"起始地继续任务" },
{5,"已到达目的地" },
{6,"目的地等待完成" },
{7,"目的地捡料完成" },
{8,"任务结束" }
}
},
{
6,
new Dictionary<int?, string>(){
{-1,"人工创建" },
{0,"未下发" },
{1,"已下发" },
{2,"已开始" },
{3,"已到达起始地" },
{4,"起始地继续任务" },
{5,"已到达目的地" },
{6,"任务结束" }
}
1 year ago
},
{
11,
new Dictionary<int?, string>(){
{-1,"人工创建" },
{0,"未下发" },
{1,"已下发" },
{2,"已开始" },
{3,"已到达起始地" },
{4,"起始地继续任务" },
{5,"已到达目的地" },
{6,"任务结束" }
}
1 year ago
}
2 years ago
};
1 year ago
private DataGridRow GetDataGridRow(DependencyObject dependencyObject)
{
if (dependencyObject == null)
return null;
var dataGridRow = dependencyObject as DataGridRow;
if (dataGridRow != null)
return dataGridRow;
return GetDataGridRow(VisualTreeHelper.GetParent(dependencyObject));
}
2 years ago
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
1 year ago
if (value is taskModel wcsTask)
2 years ago
{
1 year ago
BaseEquip baseEquip = SystemData.BaseEquip.First(t => t.objid == wcsTask.nextPointId);
1 year ago
if (dic.TryGetValue(baseEquip.equipType, out var taskStatusDic))
{
1 year ago
if (taskStatusDic.TryGetValue(wcsTask.taskStatus, out var taskStatus))
1 year ago
{
return taskStatus;
}
}
2 years ago
}
1 year ago
return "未知";
2 years ago
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}