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.
525 lines
16 KiB
C#
525 lines
16 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>
|
|
[ToolboxBitmap(typeof(System.Windows.Forms.Label))]
|
|
public partial class WeightInfoList : UserControl
|
|
{
|
|
/// <summary>
|
|
/// 称量类型枚举
|
|
/// </summary>
|
|
public enum WeightTypes
|
|
{
|
|
炭黑 = 0,
|
|
油1 = 1,
|
|
胶料 = 2,
|
|
粉料 = 3,
|
|
小料 = 4,
|
|
油2 = 5
|
|
}
|
|
|
|
private bool _bHaveAction;
|
|
private string _dataName;
|
|
private DataTable _data;
|
|
private DataTable _cloneData;
|
|
private WeightTypes _weightType = WeightTypes.炭黑;
|
|
private string _materialValueName1;
|
|
private float _materialValue1;
|
|
private string _materialValueName2;
|
|
private float _materialValue2;
|
|
private string _materialValueName3;
|
|
private float _materialValue3;
|
|
private string _materialValueName4;
|
|
private float _materialValue4;
|
|
private string _materialValueName5;
|
|
private float _materialValue5;
|
|
private string _materialValueName6;
|
|
private float _materialValue6;
|
|
private string _materialValueName7;
|
|
private float _materialValue7;
|
|
private string _materialValueName8;
|
|
private float _materialValue8;
|
|
private string _materialValueName9;
|
|
private float _materialValue9;
|
|
private string _materialValueName10;
|
|
private float _materialValue10;
|
|
private string _materialValueName11;
|
|
private float _materialValue11;
|
|
private string _materialValueName12;
|
|
private float _materialValue12;
|
|
private string _materialValueName13;
|
|
private float _materialValue13;
|
|
private string _materialValueName14;
|
|
private float _materialValue14;
|
|
private string _materialValueName15;
|
|
private float _materialValue15;
|
|
|
|
public WeightInfoList()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool BHaveAction
|
|
{
|
|
get { return _bHaveAction; }
|
|
set { _bHaveAction = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 称量类型
|
|
/// </summary>
|
|
public WeightTypes WeightType
|
|
{
|
|
get { return _weightType; }
|
|
set { _weightType = value; }
|
|
}
|
|
/// <summary>
|
|
/// 数据源动画属性
|
|
/// </summary>
|
|
public string DataName
|
|
{
|
|
get { return _dataName; }
|
|
set { _dataName = value; }
|
|
}
|
|
/// <summary>
|
|
/// 数据源
|
|
/// </summary>
|
|
public DataTable Data
|
|
{
|
|
get { return _data; }
|
|
set
|
|
{
|
|
_data = value;
|
|
if (this._cloneData == null || this._cloneData.TableName != this._data.TableName)
|
|
{
|
|
InitData();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化数据
|
|
/// </summary>
|
|
public void InitData()
|
|
{
|
|
if (this._cloneData != null)
|
|
{
|
|
this._cloneData.Dispose();
|
|
this._cloneData = null;
|
|
}
|
|
|
|
if (this._data != null)
|
|
{
|
|
this._cloneData = this._data.Copy();
|
|
if (this._cloneData != null)
|
|
{
|
|
string controlname = "recipeInfo";
|
|
InitControl();
|
|
int index = 0;
|
|
for (int i = 0; i < this._cloneData.Rows.Count; i++)
|
|
{
|
|
#region 不显示卸料称量信息
|
|
|
|
double setWeight = 0;
|
|
double.TryParse(this._cloneData.Rows[i]["SetWeight"].ToString(), out setWeight);
|
|
if (setWeight == 0)
|
|
{
|
|
continue;
|
|
}
|
|
#endregion
|
|
|
|
int wt = -2;
|
|
if (int.TryParse(this._cloneData.Rows[i]["WeightType"].ToString(), out wt))
|
|
{
|
|
if (wt != (int)this._weightType)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
index++;
|
|
Mesnac.Controls.Feeding.RecipeInfo RecipeInfo = GetControl(controlname + index.ToString()) as Mesnac.Controls.Feeding.RecipeInfo;
|
|
if (RecipeInfo != null)
|
|
{
|
|
RecipeInfo.Visible = true;
|
|
InitRecipeInfo(RecipeInfo, this._cloneData.Rows[i]["JarNum"].ToString(), this._cloneData.Rows[i]["SetWeight"].ToString(), this._cloneData.Rows[i]["ErrorAllow"].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);
|
|
jarno = jarno.Trim() == "0" ? String.Empty : jarno;
|
|
if (this._weightType != WeightTypes.炭黑 && this._weightType != WeightTypes.粉料 && this._weightType != WeightTypes.油1 && this._weightType != WeightTypes.油2)
|
|
{
|
|
jarno = String.Empty;
|
|
}
|
|
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 MaterialValue1
|
|
{
|
|
get { return this._materialValue1; }
|
|
set
|
|
{
|
|
this._materialValue1 = value;
|
|
this.RefreshCurrentValue(1, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第2种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue2
|
|
{
|
|
get { return this._materialValue2; }
|
|
set
|
|
{
|
|
this._materialValue2 = value;
|
|
this.RefreshCurrentValue(2, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第3种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue3
|
|
{
|
|
get { return this._materialValue3; }
|
|
set
|
|
{
|
|
this._materialValue3 = value;
|
|
this.RefreshCurrentValue(3, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第4种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue4
|
|
{
|
|
get { return this._materialValue4; }
|
|
set
|
|
{
|
|
this._materialValue4 = value;
|
|
this.RefreshCurrentValue(4, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第5种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue5
|
|
{
|
|
get { return this._materialValue5; }
|
|
set
|
|
{
|
|
this._materialValue5 = value;
|
|
this.RefreshCurrentValue(5, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第6种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue6
|
|
{
|
|
get { return this._materialValue6; }
|
|
set
|
|
{
|
|
this._materialValue6 = value;
|
|
this.RefreshCurrentValue(6, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第7种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue7
|
|
{
|
|
get { return this._materialValue7; }
|
|
set
|
|
{
|
|
this._materialValue7 = value;
|
|
this.RefreshCurrentValue(7, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第8种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue8
|
|
{
|
|
get { return this._materialValue8; }
|
|
set
|
|
{
|
|
this._materialValue8 = value;
|
|
this.RefreshCurrentValue(8, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第9种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue9
|
|
{
|
|
get { return this._materialValue9; }
|
|
set
|
|
{
|
|
this._materialValue9 = value;
|
|
this.RefreshCurrentValue(9, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第10种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue10
|
|
{
|
|
get { return this._materialValue10; }
|
|
set
|
|
{
|
|
this._materialValue10 = value;
|
|
this.RefreshCurrentValue(10, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第11种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue11
|
|
{
|
|
get { return this._materialValue11; }
|
|
set
|
|
{
|
|
this._materialValue11 = value;
|
|
this.RefreshCurrentValue(11, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第12种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue12
|
|
{
|
|
get { return this._materialValue12; }
|
|
set
|
|
{
|
|
this._materialValue12 = value;
|
|
this.RefreshCurrentValue(12, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第13种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue13
|
|
{
|
|
get { return this._materialValue13; }
|
|
set
|
|
{
|
|
this._materialValue13 = value;
|
|
this.RefreshCurrentValue(13, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第14种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue14
|
|
{
|
|
get { return this._materialValue14; }
|
|
set
|
|
{
|
|
this._materialValue14 = value;
|
|
this.RefreshCurrentValue(14, value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 第15种物料实际值
|
|
/// </summary>
|
|
public float MaterialValue15
|
|
{
|
|
get { return this._materialValue15; }
|
|
set
|
|
{
|
|
this._materialValue15 = value;
|
|
this.RefreshCurrentValue(15, value);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 物料实际值动画属性
|
|
|
|
/// <summary>
|
|
/// 第1种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName1
|
|
{
|
|
get { return this._materialValueName1; }
|
|
set { this._materialValueName1 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第2种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName2
|
|
{
|
|
get { return this._materialValueName2; }
|
|
set { this._materialValueName2 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第3种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName3
|
|
{
|
|
get { return this._materialValueName3; }
|
|
set { this._materialValueName3 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第4种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName4
|
|
{
|
|
get { return this._materialValueName4; }
|
|
set { this._materialValueName4 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第5种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName5
|
|
{
|
|
get { return this._materialValueName5; }
|
|
set { this._materialValueName5 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第6种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName6
|
|
{
|
|
get { return this._materialValueName6; }
|
|
set { this._materialValueName6 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第7种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName7
|
|
{
|
|
get { return this._materialValueName7; }
|
|
set { this._materialValueName7 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第8种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName8
|
|
{
|
|
get { return this._materialValueName8; }
|
|
set { this._materialValueName8 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第9种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName9
|
|
{
|
|
get { return this._materialValueName9; }
|
|
set { this._materialValueName9 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第10种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName10
|
|
{
|
|
get { return this._materialValueName10; }
|
|
set { this._materialValueName10 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第11种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName11
|
|
{
|
|
get { return this._materialValueName11; }
|
|
set { this._materialValueName11 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第12种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName12
|
|
{
|
|
get { return this._materialValueName12; }
|
|
set { this._materialValueName12 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第13种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName13
|
|
{
|
|
get { return this._materialValueName13; }
|
|
set { this._materialValueName13 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第14种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName14
|
|
{
|
|
get { return this._materialValueName14; }
|
|
set { this._materialValueName14 = value; }
|
|
}
|
|
/// <summary>
|
|
/// 第15种物料实际值动画属性
|
|
/// </summary>
|
|
public string MaterialValueName15
|
|
{
|
|
get { return this._materialValueName15; }
|
|
set { this._materialValueName15 = value; }
|
|
}
|
|
#endregion
|
|
}
|
|
}
|