Merge branch 'master' of http://192.168.0.12:13000/sc/Audit_APP
This commit is contained in:
commit
9ede634f3c
115 files changed
+2666
-7523
No files matched your search
@@ -0,0 +1,46 @@
|
||||
using Audit.View;
|
||||
using Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
/// <summary>
|
||||
/// 统计消耗量变换器
|
||||
/// 输入:原料代码、时间区间
|
||||
/// 输出:消耗总量(KG)
|
||||
/// </summary>
|
||||
namespace Audit.ConvertMoels
|
||||
{
|
||||
internal class ConsumptionConvert : IValueConverter
|
||||
{
|
||||
private DyelotsBulkedRecipe dyelotsBulkedRecipe = new DyelotsBulkedRecipe();
|
||||
// public static string Code = null;
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_start)) StatisticsView.query_start = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");//默认开始时间当前日期前30天
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_end)) StatisticsView.query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");//默认结束时间当前日期后一天
|
||||
dyelotsBulkedRecipe.ProductCode = System.Convert.ToString(value);//传递原料代码
|
||||
dyelotsBulkedRecipe.DispenseStartTime = System.Convert.ToDateTime(StatisticsView.query_start + " " + StatisticsView.date_start_time);//传递开始时间
|
||||
dyelotsBulkedRecipe.DispenseEndTime = System.Convert.ToDateTime(StatisticsView.query_end + " " + StatisticsView.date_end_time);//传递结束时间
|
||||
float sum_grams = (float)new DyelotsBulkedRecipeProvider().SelectCode(dyelotsBulkedRecipe).Sum(x => x.DispenseGrams);//查询并返回统计结果
|
||||
if (sum_grams == 0)//统计结果为0返回空非0返回实际值
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
float sum = sum_grams / 1000;//计算
|
||||
return sum.ToString("#0.00");//返回总消耗两位
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,11 @@ namespace Audit.ConvertMoels
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string a = System.Convert.ToString(values[0]);
|
||||
string b = System.Convert.ToString(values[1]);
|
||||
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");
|
||||
string c = (System.Convert.ToSingle(b) - System.Convert.ToSingle(a)).ToString("0.0");//计算值1和2的差值并返回字符串
|
||||
//string c = "0";
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using Audit.View;
|
||||
using Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
/// <summary>
|
||||
/// 统计成本变换器
|
||||
/// 输入:原料代码、原料价格、时间区间
|
||||
/// 输出:总成本
|
||||
/// </summary>
|
||||
namespace Audit.ConvertMoels
|
||||
{
|
||||
internal class GramsSumConvert : IMultiValueConverter
|
||||
{
|
||||
private DyelotsBulkedRecipe dyelotsBulkedRecipe = new DyelotsBulkedRecipe();
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string productcode = System.Convert.ToString(values[0]);//转换数组1的信息原料代码
|
||||
float price = System.Convert.ToSingle(values[1]);//转换数组2的信息单价
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_start)) StatisticsView.query_start = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");//默认开始时间当前日期前30天
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_end)) StatisticsView.query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");//默认结束时间当前日期后一天
|
||||
dyelotsBulkedRecipe.ProductCode = System.Convert.ToString(productcode);//传递原料代码
|
||||
dyelotsBulkedRecipe.DispenseStartTime = System.Convert.ToDateTime(StatisticsView.query_start);//传递开始时间
|
||||
dyelotsBulkedRecipe.DispenseEndTime = System.Convert.ToDateTime(StatisticsView.query_end);//传递结束时间
|
||||
float sum_grams = (float)new DyelotsBulkedRecipeProvider().SelectCode(dyelotsBulkedRecipe).Sum(x => x.DispenseGrams);//查询并返回统计结果
|
||||
if (sum_grams > 0 && price > 0)
|
||||
{
|
||||
float sum = (sum_grams * price) / 1000;//计算
|
||||
return sum.ToString("#0.00");//返回总成本两位小数(元)
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using Audit.View;
|
||||
using Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
/// <summary>
|
||||
/// 统计机台单料数变换器
|
||||
/// 输入:原料代码、机台代码、时间区间
|
||||
/// 输出:机台料单数
|
||||
/// </summary>
|
||||
namespace Audit.ConvertMoels
|
||||
{
|
||||
internal class MachinesDyelotsNumberConvert : IValueConverter
|
||||
{
|
||||
private Dyelots dyelots = new Dyelots();
|
||||
private DyelotsBulkedRecipe dyelotsBulkedRecipe = new DyelotsBulkedRecipe();
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string machines = System.Convert.ToString(value);//转换机台号
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_start)) StatisticsView.query_start = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");//默认开始时间当前日期前30天
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_end)) StatisticsView.query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");//默认结束时间当前日期后一天
|
||||
dyelots.Machine = System.Convert.ToString(machines);//传递机台
|
||||
//dyelots.StartTime = System.Convert.ToString(machines);
|
||||
//float sum_grams = (float)new DyelotsBulkedRecipeProvider().SelectCode(dyelotsBulkedRecipe).Sum(x => x.DispenseGrams);//查询并返回统计结果
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.DataGridStatistics_ProductCode))//原料代码名有效返回数据,无效返回空
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
dyelotsBulkedRecipe.Dispenser = System.Convert.ToString(machines);//传递机台
|
||||
dyelotsBulkedRecipe.ProductCode = StatisticsView.DataGridStatistics_ProductCode;
|
||||
dyelotsBulkedRecipe.DispenseStartTime = System.Convert.ToDateTime(StatisticsView.query_start);
|
||||
dyelotsBulkedRecipe.DispenseEndTime = System.Convert.ToDateTime(StatisticsView.query_end);
|
||||
float Machines_Number = (float)new DyelotsBulkedRecipeProvider().SelectMachineSUM(dyelotsBulkedRecipe).Count(t => t.ReDye == 0);//查询并返回统计结果
|
||||
if (Machines_Number == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Machines_Number;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using Audit.View;
|
||||
using Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
/// <summary>
|
||||
/// 统计机台消耗变换器
|
||||
/// 输入:原料代码、机台代码、时间区间
|
||||
/// 输出:机台消耗
|
||||
/// </summary>
|
||||
namespace Audit.ConvertMoels
|
||||
{
|
||||
internal class MachinesGramsSumConvert : IValueConverter
|
||||
{
|
||||
private Dyelots dyelots = new Dyelots();
|
||||
private DyelotsBulkedRecipe dyelotsBulkedRecipe = new DyelotsBulkedRecipe();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string machines = System.Convert.ToString(value);//转换机台号
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_start)) StatisticsView.query_start = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd");//默认开始时间当前日期前30天
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.query_end)) StatisticsView.query_end = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");//默认结束时间当前日期后一天
|
||||
if (string.IsNullOrWhiteSpace(StatisticsView.DataGridStatistics_ProductCode))//原料代码名有效返回数据,无效返回空
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
dyelotsBulkedRecipe.Dispenser = System.Convert.ToString(machines);//传递机台
|
||||
dyelotsBulkedRecipe.ProductCode = StatisticsView.DataGridStatistics_ProductCode;
|
||||
dyelotsBulkedRecipe.DispenseStartTime = System.Convert.ToDateTime(StatisticsView.query_start);
|
||||
dyelotsBulkedRecipe.DispenseEndTime = System.Convert.ToDateTime(StatisticsView.query_end);
|
||||
float Machines_sum = (float)new DyelotsBulkedRecipeProvider().SelectMachineSUM(dyelotsBulkedRecipe).Sum(x => x.DispenseGrams);//查询并返回统计结果
|
||||
if (Machines_sum == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
string Machines_grams_sum = (Machines_sum / 1000).ToString("#0.00");
|
||||
return Machines_grams_sum;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace Audit.ConvertMoels
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string ProductType = System.Convert.ToString(value);
|
||||
if (ProductType == "0")//类型0:染料,1:助剂,2:粉体助剂,其它:未知
|
||||
if (ProductType == "0")//类型0:染料,1:助剂,2:粉体助剂,3:液体染料,其它:未知
|
||||
{
|
||||
return "染料";
|
||||
}
|
||||
@@ -37,7 +37,14 @@ namespace Audit.ConvertMoels
|
||||
}
|
||||
else
|
||||
{
|
||||
return "未知类型";
|
||||
if (ProductType == "3")
|
||||
{
|
||||
return "液体染料";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "未知类型";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Audit.View;
|
||||
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 SumSQLConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
string a = StatisticsView.query_start;
|
||||
string b = StatisticsView.query_end;
|
||||
return null;
|
||||
}
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user