diff --git a/ConvertMoels/DeviationConvert.cs b/ConvertMoels/DeviationConvert.cs new file mode 100644 index 0000000..934f487 --- /dev/null +++ b/ConvertMoels/DeviationConvert.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Audit.ConvertMoels +{ + internal class DeviationConvert : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + string a = System.Convert.ToString(values[0]);//转换数组1的信息 + string b = System.Convert.ToString(values[1]);//转换数组2的信息 + if (a != "" && b != "") + { + string c = (System.Convert.ToSingle(b) - System.Convert.ToSingle(a)).ToString("0.0");//计算值1和2的差值并返回字符串 + //string c = "0"; + return c; + } + return null; + } + + public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + } +} diff --git a/ConvertMoels/GramsSQLConvert.cs b/ConvertMoels/GramsSQLConvert.cs new file mode 100644 index 0000000..937b437 --- /dev/null +++ b/ConvertMoels/GramsSQLConvert.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Audit.ConvertMoels +{ + /// + /// 零值标红转换器 + /// DispenseGrams为零的单元格文本标红返回 + /// + internal class GramsSQLConvert : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + string G = System.Convert.ToString(value); + if (G == "0")//判断单元格值是否为零 + { + return "red";//零返回红色 + } + else + { + return "black";//非零返回黑色 + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } +} diff --git a/ConvertMoels/StatenConvert.cs b/ConvertMoels/StatenConvert.cs new file mode 100644 index 0000000..c24c943 --- /dev/null +++ b/ConvertMoels/StatenConvert.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Controls; + +/// +/// 运行状态变换器 +/// 输入:状态码 +/// 输出:状态文字 +/// +namespace Audit.ConvertMoels +{ + internal class StatenConvert : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (value == null) + { + return null; + } + else + { + string Staten = null; + string i = value.ToString(); + + if (i == "101") Staten = "准备就绪"; + if (i == "102") Staten = "计量输送"; + if (i == "201") Staten = "自动状态"; + if (i == "202") Staten = "转入排队"; + if (i == "203") Staten = "等待命令"; + if (i == "301") Staten = "工单完成"; + if (i == "309") Staten = "输送异常"; + + return Staten; + } + } + + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + + } +} diff --git a/ConvertMoels/StatenERRConvert.cs b/ConvertMoels/StatenERRConvert.cs new file mode 100644 index 0000000..48e0420 --- /dev/null +++ b/ConvertMoels/StatenERRConvert.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Controls; + +namespace Audit.ConvertMoels +{ + internal class StatenERRConvert : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (value == null) + { + return null; + } + else + { + if (value.ToString() == "309") + { + return "red";//零返回红色 + } + else + { + return "black";//非零返回黑色 + } + } + } + + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/formula_manage.csproj b/formula_manage.csproj index 16e7abd..337f2c1 100644 --- a/formula_manage.csproj +++ b/formula_manage.csproj @@ -101,7 +101,11 @@ Designer + + + + Login.xaml