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.
463 lines
14 KiB
C#
463 lines
14 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Controls.Feeding
|
|
{
|
|
/// <summary>
|
|
/// 混炼画面称量物料信息
|
|
/// </summary>
|
|
public partial class RecipeInfoCB : UserControl
|
|
{
|
|
#region 字段定义
|
|
|
|
private string _dataName;
|
|
private DataTable _data;
|
|
private string _smallMaterialValueName1;
|
|
private float _smallMaterialValue1;
|
|
private string _smallMaterialValueName2;
|
|
private float _smallMaterialValue2;
|
|
private string _smallMaterialValueName3;
|
|
private float _smallMaterialValue3;
|
|
private string _smallMaterialValueName4;
|
|
private float _smallMaterialValue4;
|
|
private string _smallMaterialValueName5;
|
|
private float _smallMaterialValue5;
|
|
private string _smallMaterialValueName6;
|
|
private float _smallMaterialValue6;
|
|
private string _smallMaterialValueName7;
|
|
private float _smallMaterialValue7;
|
|
private string _smallMaterialValueName8;
|
|
private float _smallMaterialValue8;
|
|
private string _smallMaterialValueName9;
|
|
private float _smallMaterialValue9;
|
|
private string _smallMaterialValueName10;
|
|
private float _smallMaterialValue10;
|
|
private string _smallMaterialValueName11;
|
|
private float _smallMaterialValue11;
|
|
private string _smallMaterialValueName12;
|
|
private float _smallMaterialValue12;
|
|
private string _smallMaterialValueName13;
|
|
private float _smallMaterialValue13;
|
|
private string _smallMaterialValueName14;
|
|
private float _smallMaterialValue14;
|
|
private string _smallMaterialValueName15;
|
|
private float _smallMaterialValue15;
|
|
|
|
#endregion
|
|
|
|
public RecipeInfoCB()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 数据源动画属性
|
|
/// </summary>
|
|
public string DataName
|
|
{
|
|
get { return _dataName; }
|
|
set { _dataName = value; }
|
|
}
|
|
/// <summary>
|
|
/// 数据源
|
|
/// </summary>
|
|
public DataTable Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
if (value != null)
|
|
{
|
|
_data = value;
|
|
string controlname = "recipeInfo";
|
|
InitControl();
|
|
for (int i = 0; i < _data.Rows.Count; i++)
|
|
{
|
|
#region 不显示卸料称量信息
|
|
|
|
double setWeight = 0;
|
|
double.TryParse(_data.Rows[i]["设定"].ToString(), out setWeight);
|
|
if (setWeight == 0)
|
|
{
|
|
continue;
|
|
}
|
|
#endregion
|
|
|
|
Mesnac.Controls.Feeding.RecipeInfo RecipeInfo = GetControl(controlname + (i + 1).ToString()) as Mesnac.Controls.Feeding.RecipeInfo;
|
|
if (RecipeInfo != null)
|
|
{
|
|
RecipeInfo.Visible = true;
|
|
InitRecipeInfo(RecipeInfo, _data.Rows[i]["罐号"].ToString(), _data.Rows[i]["设定"].ToString(), _data.Rows[i]["误差"].ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 获取控件
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
/// <returns></returns>
|
|
private Control GetControl(string name)
|
|
{
|
|
foreach (Control Item in this.Controls)
|
|
{
|
|
if (Item.Name == name)
|
|
{
|
|
return Item;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
private void InitControl()
|
|
{
|
|
foreach (Control Item in this.Controls)
|
|
{
|
|
if (Item.Name.Contains("recipeInfo"))
|
|
{
|
|
Item.Visible = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化配方信息
|
|
/// </summary>
|
|
private void InitRecipeInfo(Mesnac.Controls.Feeding.RecipeInfo recipeinfo, string jarno,string setvalue, string errorvalue)
|
|
{
|
|
float defualt = 0;
|
|
setvalue = float.TryParse(setvalue, out defualt) ? Convert.ToDecimal(setvalue).ToString("f2") : defualt.ToString();
|
|
errorvalue = float.TryParse(errorvalue, out defualt) ? Convert.ToDecimal(errorvalue).ToString("f2") : defualt.ToString();
|
|
//setvalue = String.Format("{0:N2}", setvalue);
|
|
//errorvalue = String.Format("{0:N2}", errorvalue);
|
|
recipeinfo.JarNo = jarno;
|
|
recipeinfo.SetValue = setvalue;
|
|
recipeinfo.ErrorValue = errorvalue;
|
|
}
|
|
|
|
|
|
private void RefreshCurrentValue(int index, float value)
|
|
{
|
|
string controlname = "recipeInfo";
|
|
Mesnac.Controls.Feeding.RecipeInfo RecipeInfo = GetControl(controlname + index.ToString()) as Mesnac.Controls.Feeding.RecipeInfo;
|
|
if (RecipeInfo != null)
|
|
RecipeInfo.FactValue = value;
|
|
}
|
|
|
|
#region 物料实际值属性
|
|
/// <summary>
|
|
/// 第1种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue1
|
|
{
|
|
get { return this._smallMaterialValue1; }
|
|
set
|
|
{
|
|
this._smallMaterialValue1 = value;
|
|
this.RefreshCurrentValue(1, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第2种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue2
|
|
{
|
|
get { return this._smallMaterialValue2; }
|
|
set
|
|
{
|
|
this._smallMaterialValue2 = value;
|
|
this.RefreshCurrentValue(2, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第3种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue3
|
|
{
|
|
get { return this._smallMaterialValue3; }
|
|
set
|
|
{
|
|
this._smallMaterialValue3 = value;
|
|
this.RefreshCurrentValue(3, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第4种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue4
|
|
{
|
|
get { return this._smallMaterialValue4; }
|
|
set
|
|
{
|
|
this._smallMaterialValue4 = value;
|
|
this.RefreshCurrentValue(4, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第5种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue5
|
|
{
|
|
get { return this._smallMaterialValue5; }
|
|
set
|
|
{
|
|
this._smallMaterialValue5 = value;
|
|
this.RefreshCurrentValue(5, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第6种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue6
|
|
{
|
|
get { return this._smallMaterialValue6; }
|
|
set
|
|
{
|
|
this._smallMaterialValue6 = value;
|
|
this.RefreshCurrentValue(6, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第7种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue7
|
|
{
|
|
get { return this._smallMaterialValue7; }
|
|
set
|
|
{
|
|
this._smallMaterialValue7 = value;
|
|
this.RefreshCurrentValue(7, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第8种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue8
|
|
{
|
|
get { return this._smallMaterialValue8; }
|
|
set
|
|
{
|
|
this._smallMaterialValue8 = value;
|
|
this.RefreshCurrentValue(8, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第9种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue9
|
|
{
|
|
get { return this._smallMaterialValue9; }
|
|
set
|
|
{
|
|
this._smallMaterialValue9 = value;
|
|
this.RefreshCurrentValue(9, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第10种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue10
|
|
{
|
|
get { return this._smallMaterialValue10; }
|
|
set
|
|
{
|
|
this._smallMaterialValue10 = value;
|
|
this.RefreshCurrentValue(10, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第11种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue11
|
|
{
|
|
get { return this._smallMaterialValue11; }
|
|
set
|
|
{
|
|
this._smallMaterialValue11 = value;
|
|
this.RefreshCurrentValue(11, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第12种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue12
|
|
{
|
|
get { return this._smallMaterialValue12; }
|
|
set
|
|
{
|
|
this._smallMaterialValue12 = value;
|
|
this.RefreshCurrentValue(12, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第13种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue13
|
|
{
|
|
get { return this._smallMaterialValue13; }
|
|
set
|
|
{
|
|
this._smallMaterialValue13 = value;
|
|
this.RefreshCurrentValue(13, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第14种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue14
|
|
{
|
|
get { return this._smallMaterialValue14; }
|
|
set
|
|
{
|
|
this._smallMaterialValue14 = value;
|
|
this.RefreshCurrentValue(14, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第15种物料实际值
|
|
/// </summary>
|
|
public float SmallMaterialValue15
|
|
{
|
|
get { return this._smallMaterialValue15; }
|
|
set
|
|
{
|
|
this._smallMaterialValue15 = value;
|
|
this.RefreshCurrentValue(15, value);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 物料实际值动画属性
|
|
/// <summary>
|
|
/// 第1种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName1
|
|
{
|
|
get { return this._smallMaterialValueName1; }
|
|
set { this._smallMaterialValueName1 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第2种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName2
|
|
{
|
|
get { return this._smallMaterialValueName2; }
|
|
set { this._smallMaterialValueName2 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第3种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName3
|
|
{
|
|
get { return this._smallMaterialValueName3; }
|
|
set { this._smallMaterialValueName3 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第4种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName4
|
|
{
|
|
get { return this._smallMaterialValueName4; }
|
|
set { this._smallMaterialValueName4 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第5种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName5
|
|
{
|
|
get { return this._smallMaterialValueName5; }
|
|
set { this._smallMaterialValueName5 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第6种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName6
|
|
{
|
|
get { return this._smallMaterialValueName6; }
|
|
set { this._smallMaterialValueName6 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第7种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName7
|
|
{
|
|
get { return this._smallMaterialValueName7; }
|
|
set { this._smallMaterialValueName7 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第8种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName8
|
|
{
|
|
get { return this._smallMaterialValueName8; }
|
|
set { this._smallMaterialValueName8 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第9种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName9
|
|
{
|
|
get { return this._smallMaterialValueName9; }
|
|
set { this._smallMaterialValueName9 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第10种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName10
|
|
{
|
|
get { return this._smallMaterialValueName10; }
|
|
set { this._smallMaterialValueName10 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第11种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName11
|
|
{
|
|
get { return this._smallMaterialValueName11; }
|
|
set { this._smallMaterialValueName11 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第12种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName12
|
|
{
|
|
get { return this._smallMaterialValueName12; }
|
|
set { this._smallMaterialValueName12 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第13种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName13
|
|
{
|
|
get { return this._smallMaterialValueName13; }
|
|
set { this._smallMaterialValueName13 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第14种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName14
|
|
{
|
|
get { return this._smallMaterialValueName14; }
|
|
set { this._smallMaterialValueName14 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第15种物料实际值动画属性
|
|
/// </summary>
|
|
public string SmallMaterialValueName15
|
|
{
|
|
get { return this._smallMaterialValueName15; }
|
|
set { this._smallMaterialValueName15 = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|