sc 2 years ago
parent
commit
cc85c54dc3
  1. 32
      ConvertMoels/DeviationConvert.cs
  2. 35
      ConvertMoels/GramsSQLConvert.cs
  3. 50
      ConvertMoels/StatenConvert.cs
  4. 40
      ConvertMoels/StatenERRConvert.cs
  5. 4
      formula_manage.csproj

32
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();
}
}
}

35
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
{
/// <summary>
/// 零值标红转换器
/// DispenseGrams为零的单元格文本标红返回
/// </summary>
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;
}
}
}

50
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;
/// <summary>
/// 运行状态变换器
/// 输入:状态码
/// 输出:状态文字
/// </summary>
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();
}
}
}

40
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();
}
}
}

4
formula_manage.csproj

@ -101,7 +101,11 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ConvertMoels\ColorSQLConvert.cs" />
<Compile Include="ConvertMoels\DeviationConvert.cs" />
<Compile Include="ConvertMoels\GramsSQLConvert.cs" />
<Compile Include="ConvertMoels\ProductTypeSQLConvert.cs" />
<Compile Include="ConvertMoels\StatenConvert.cs" />
<Compile Include="ConvertMoels\StatenERRConvert.cs" />
<Compile Include="Login.xaml.cs">
<DependentUpon>Login.xaml</DependentUpon>
</Compile>

Loading…
Cancel
Save