using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Media;
using FLY.OBJComponents.IService;
using Misc;
namespace FLY.Weight.Common
{
public class WeighterC:INotifyPropertyChanged,IPropertyOpt
{
public WeighterC(string number, int binCnt)
{
Number = number;
BinCnt = binCnt;
BinsBinding();
}
public event PropertyChangedEventHandler PropertyChanged;
#region IWeighterC实现
///
/// 名称:A,B,C,D,E
///
public string Number { get; set; }
///
/// 颜色
///
public Brush Color { get; set; }
///
/// 料仓数
///
public int BinCnt { get; protected set; }
#endregion
#region 辅助代码生成
///
/// 报警开关
///
[Description("报警开关")]
public bool AlarmIsOn{ get; set; }
///
/// 报警复位
///
[Description("报警复位")]
public bool IsAlarmReseted{ get; set; }
///
/// 累计产量
///
[Description("累计产量")]
public float CumulativeProduction{ get; set; }
///
/// 配料斗重量显示
///
[Description("配料斗重量显示")]
public float MixBucketWeight{ get; set; }
///
/// 配料斗阀门
///
[Description("配料斗阀门")]
public bool BucketValveIsOpen{ get; set; }
///
/// 配料操作
///
[Description("配料操作")]
public bool MixIsOn{ get; set; }
///
/// 失重仓重量
///
[Description("失重仓重量")]
public float BinWeight{ get; set; }
///
/// 当前产量
///
[Description("当前产量")]
public float CurrentFlow{ get; set; }
///
/// 设定产量
///
[Description("设定产量")]
public float FlowSetting{ get; set; }
///
/// 运行比例
///
[Description("运行比例")]
public float ScrewPDisp{ get; set; }
///
/// 设定比例
///
[Description("设定比例")]
public float ScrewPSet{ get; set; }
///
/// 运行频率
///
[Description("运行频率")]
public float ScrewMotorFreq{ get; set; }
///
/// 设定频率
///
[Description("设定频率")]
public float ScrewManualFreq{ get; set; }
///
/// 设定频率确定
///
[Description("设定频率确定")]
public bool ScrewManualFreqIsSet{ get; set; }
///
/// 螺杆模式
///
[Description("螺杆模式")]
public bool ScrewIsAutoMode{ get; set; }
///
/// 螺杆操作
///
[Description("螺杆操作")]
public bool ScrewMotorIsOn{ get; set; }
///
/// 配料数据保存
///
[Description("配料数据保存")]
public bool IsMixSave{ get; set; }
///
/// 1#比例设定
///
[Description("1#比例设定")]
public float MixPSet_1{ get; set; }
///
/// 2#比例设定
///
[Description("2#比例设定")]
public float MixPSet_2{ get; set; }
///
/// 3#比例设定
///
[Description("3#比例设定")]
public float MixPSet_3{ get; set; }
///
/// 4#比例设定
///
[Description("4#比例设定")]
public float MixPSet_4{ get; set; }
///
/// 5#比例设定
///
[Description("5#比例设定")]
public float MixPSet_5{ get; set; }
///
/// 6#比例设定
///
[Description("6#比例设定")]
public float MixPSet_6{ get; set; }
///
/// 1#比例显示
///
[Description("1#比例显示")]
public float MixPDisp_1{ get; set; }
///
/// 2#比例显示
///
[Description("2#比例显示")]
public float MixPDisp_2{ get; set; }
///
/// 3#比例显示
///
[Description("3#比例显示")]
public float MixPDisp_3{ get; set; }
///
/// 4#比例显示
///
[Description("4#比例显示")]
public float MixPDisp_4{ get; set; }
///
/// 5#比例显示
///
[Description("5#比例显示")]
public float MixPDisp_5{ get; set; }
///
/// 6#比例显示
///
[Description("6#比例显示")]
public float MixPDisp_6{ get; set; }
///
/// 1#重量设定
///
[Description("1#重量设定")]
public float MixSet_1{ get; set; }
///
/// 2#重量设定
///
[Description("2#重量设定")]
public float MixSet_2{ get; set; }
///
/// 3#重量设定
///
[Description("3#重量设定")]
public float MixSet_3{ get; set; }
///
/// 4#重量设定
///
[Description("4#重量设定")]
public float MixSet_4{ get; set; }
///
/// 5#重量设定
///
[Description("5#重量设定")]
public float MixSet_5{ get; set; }
///
/// 6#重量设定
///
[Description("6#重量设定")]
public float MixSet_6{ get; set; }
///
/// 1#重量显示
///
[Description("1#重量显示")]
public float MixDisp_1{ get; set; }
///
/// 2#重量显示
///
[Description("2#重量显示")]
public float MixDisp_2{ get; set; }
///
/// 3#重量显示
///
[Description("3#重量显示")]
public float MixDisp_3{ get; set; }
///
/// 4#重量显示
///
[Description("4#重量显示")]
public float MixDisp_4{ get; set; }
///
/// 5#重量显示
///
[Description("5#重量显示")]
public float MixDisp_5{ get; set; }
///
/// 6#重量显示
///
[Description("6#重量显示")]
public float MixDisp_6{ get; set; }
///
/// 1#放料
///
[Description("1#放料")]
public bool MixLight_1{ get; set; }
///
/// 2#放料
///
[Description("2#放料")]
public bool MixLight_2{ get; set; }
///
/// 3#放料
///
[Description("3#放料")]
public bool MixLight_3{ get; set; }
///
/// 4#放料
///
[Description("4#放料")]
public bool MixLight_4{ get; set; }
///
/// 5#放料
///
[Description("5#放料")]
public bool MixLight_5{ get; set; }
///
/// 6#放料
///
[Description("6#放料")]
public bool MixLight_6{ get; set; }
///
/// 配料斗卸载
///
[Description("配料斗卸载")]
public bool MixUnload{ get; set; }
///
/// 配料斗重量设置
///
[Description("配料斗重量设置")]
public float MixSet{ get; set; }
///
/// 配料斗重量显示
///
[Description("配料斗重量显示")]
public float MixDisp{ get; set; }
///
/// 1#累计重量
///
[Description("1#累计重量")]
public float MixCum_1{ get; set; }
///
/// 2#累计重量
///
[Description("2#累计重量")]
public float MixCum_2{ get; set; }
///
/// 3#累计重量
///
[Description("3#累计重量")]
public float MixCum_3{ get; set; }
///
/// 4#累计重量
///
[Description("4#累计重量")]
public float MixCum_4{ get; set; }
///
/// 5#累计重量
///
[Description("5#累计重量")]
public float MixCum_5{ get; set; }
///
/// 6#累计重量
///
[Description("6#累计重量")]
public float MixCum_6{ get; set; }
///
/// 1#累计百分比
///
[Description("1#累计百分比")]
public float MixCumPercent_1{ get; set; }
///
/// 2#累计百分比
///
[Description("2#累计百分比")]
public float MixCumPercent_2{ get; set; }
///
/// 3#累计百分比
///
[Description("3#累计百分比")]
public float MixCumPercent_3{ get; set; }
///
/// 4#累计百分比
///
[Description("4#累计百分比")]
public float MixCumPercent_4{ get; set; }
///
/// 5#累计百分比
///
[Description("5#累计百分比")]
public float MixCumPercent_5{ get; set; }
///
/// 6#累计百分比
///
[Description("6#累计百分比")]
public float MixCumPercent_6{ get; set; }
///
/// 产量清零
///
[Description("产量清零")]
public bool ClearProduction{ get; set; }
///
/// 流量方式
///
[Description("流量方式")]
public bool FlowCalMethodIsA{ get; set; }
///
/// 流量反馈
///
[Description("流量反馈")]
public float FlowDisp{ get; set; }
///
/// 滤波系数设定
///
[Description("滤波系数设定")]
public float FilterParam{ get; set; }
///
/// 切换级别设定
///
[Description("切换级别设定")]
public float SwitchLv{ get; set; }
///
/// 升降增益设定
///
[Description("升降增益设定")]
public float UpDownGain{ get; set; }
///
/// 比例增益设定
///
[Description("比例增益设定")]
public float PGain{ get; set; }
///
/// 积分时间设定
///
[Description("积分时间设定")]
public float ITime{ get; set; }
///
/// 调节系数设定
///
[Description("调节系数设定")]
public float AdjustFactor{ get; set; }
///
/// 调节上限设定
///
[Description("调节上限设定")]
public float AdjustUpper{ get; set; }
///
/// 调节下限设定
///
[Description("调节下限设定")]
public float AdjustLower{ get; set; }
///
/// 稳定级别切换
///
[Description("稳定级别切换")]
public float StableLvSwitch{ get; set; }
///
/// PID调节限幅
///
[Description("PID调节限幅")]
public float PIDLimit{ get; set; }
///
/// 采样时间
///
[Description("采样时间")]
public float SampleTime{ get; set; }
///
/// PID结果
///
[Description("PID结果")]
public float PIDResult{ get; set; }
///
/// PID调节
///
[Description("PID调节")]
public float PIDAdjust{ get; set; }
///
/// 实际速度
///
[Description("实际速度")]
public float ScrewCurrentSpeed{ get; set; }
///
/// 比例增益
///
[Description("比例增益")]
public float PGainDisp{ get; set; }
///
/// 卸料时间
///
[Description("卸料时间")]
public float UnloadingTime{ get; set; }
///
/// 零位稳定时间
///
[Description("零位稳定时间")]
public float ZeroStableTime{ get; set; }
///
/// 流量切换允许
///
[Description("流量切换允许")]
public float FlowSwitchEnable{ get; set; }
///
/// 取样时间设定(s)
///
[Description("取样时间设定(s)")]
public float SampleTimeSet{ get; set; }
///
/// 额定频率(Hz)
///
[Description("额定频率(Hz)")]
public float ScrewMotorRatedFreq{ get; set; }
///
/// 重量稳定时间(s)
///
[Description("重量稳定时间(s)")]
public float WeightStableTime{ get; set; }
///
/// 料位下限设定(kg)
///
[Description("料位下限设定(kg)")]
public float MaterialLowLimitSet{ get; set; }
///
/// 报警偏差设定(%)
///
[Description("报警偏差设定(%)")]
public float AlarmDeviationSet{ get; set; }
///
/// 重量校正系数
///
[Description("重量校正系数")]
public float WeightCorrectFactor{ get; set; }
///
/// 缺料报警设定(kg)
///
[Description("缺料报警设定(kg)")]
public float LackErrorSet{ get; set; }
///
/// 搅拌时间设定(s)
///
[Description("搅拌时间设定(s)")]
public float MixingTimeSet{ get; set; }
///
/// 1次补料偏差
///
[Description("1次补料偏差")]
public float FeedingDeviation_1{ get; set; }
///
/// 2次补料偏差
///
[Description("2次补料偏差")]
public float FeedingDeviation_2{ get; set; }
///
/// 3次补料偏差
///
[Description("3次补料偏差")]
public float FeedingDeviation_3{ get; set; }
///
/// 4次补料偏差
///
[Description("4次补料偏差")]
public float FeedingDeviation_4{ get; set; }
///
/// 5次补料偏差
///
[Description("5次补料偏差")]
public float FeedingDeviation_5{ get; set; }
///
/// 6次补料偏差
///
[Description("6次补料偏差")]
public float FeedingDeviation_6{ get; set; }
///
/// 1次加料设定
///
[Description("1次加料设定")]
public float FeedSet_1{ get; set; }
///
/// 2次加料设定
///
[Description("2次加料设定")]
public float FeedSet_2{ get; set; }
///
/// 3次加料设定
///
[Description("3次加料设定")]
public float FeedSet_3{ get; set; }
///
/// 4次加料设定
///
[Description("4次加料设定")]
public float FeedSet_4{ get; set; }
///
/// 5次加料设定
///
[Description("5次加料设定")]
public float FeedSet_5{ get; set; }
///
/// 6次加料设定
///
[Description("6次加料设定")]
public float FeedSet_6{ get; set; }
///
/// 1#初始时间
///
[Description("1#初始时间")]
public float InitTime_1{ get; set; }
///
/// 2#初始时间
///
[Description("2#初始时间")]
public float InitTime_2{ get; set; }
///
/// 3#初始时间
///
[Description("3#初始时间")]
public float InitTime_3{ get; set; }
///
/// 4#初始时间
///
[Description("4#初始时间")]
public float InitTime_4{ get; set; }
///
/// 5#初始时间
///
[Description("5#初始时间")]
public float InitTime_5{ get; set; }
///
/// 6#初始时间
///
[Description("6#初始时间")]
public float InitTime_6{ get; set; }
///
/// 1#最小时间
///
[Description("1#最小时间")]
public float MinTime_1{ get; set; }
///
/// 2#最小时间
///
[Description("2#最小时间")]
public float MinTime_2{ get; set; }
///
/// 3#最小时间
///
[Description("3#最小时间")]
public float MinTime_3{ get; set; }
///
/// 4#最小时间
///
[Description("4#最小时间")]
public float MinTime_4{ get; set; }
///
/// 5#最小时间
///
[Description("5#最小时间")]
public float MinTime_5{ get; set; }
///
/// 6#最小时间
///
[Description("6#最小时间")]
public float MinTime_6{ get; set; }
///
/// 1#稳重时间
///
[Description("1#稳重时间")]
public float StableTime_1{ get; set; }
///
/// 2#稳重时间
///
[Description("2#稳重时间")]
public float StableTime_2{ get; set; }
///
/// 3#稳重时间
///
[Description("3#稳重时间")]
public float StableTime_3{ get; set; }
///
/// 4#稳重时间
///
[Description("4#稳重时间")]
public float StableTime_4{ get; set; }
///
/// 5#稳重时间
///
[Description("5#稳重时间")]
public float StableTime_5{ get; set; }
///
/// 6#稳重时间
///
[Description("6#稳重时间")]
public float StableTime_6{ get; set; }
///
/// 1次料仓报警设定
///
[Description("1次料仓报警设定")]
public float BinAlarmSet_1{ get; set; }
///
/// 2次料仓报警设定
///
[Description("2次料仓报警设定")]
public float BinAlarmSet_2{ get; set; }
///
/// 3次料仓报警设定
///
[Description("3次料仓报警设定")]
public float BinAlarmSet_3{ get; set; }
///
/// 4次料仓报警设定
///
[Description("4次料仓报警设定")]
public float BinAlarmSet_4{ get; set; }
///
/// 5次料仓报警设定
///
[Description("5次料仓报警设定")]
public float BinAlarmSet_5{ get; set; }
///
/// 6次料仓报警设定
///
[Description("6次料仓报警设定")]
public float BinAlarmSet_6{ get; set; }
///
/// No.1料仓缺料报警 (ON)
///
[Description("No.1料仓缺料报警")]
[IsError()]
public bool IsErrorOfLack_1{ get; set; }
///
/// No.2料仓缺料报警 (ON)
///
[Description("No.2料仓缺料报警")]
[IsError()]
public bool IsErrorOfLack_2{ get; set; }
///
/// No.3料仓缺料报警 (ON)
///
[Description("No.3料仓缺料报警")]
[IsError()]
public bool IsErrorOfLack_3{ get; set; }
///
/// No.4料仓缺料报警 (ON)
///
[Description("No.4料仓缺料报警")]
[IsError()]
public bool IsErrorOfLack_4{ get; set; }
///
/// No.5料仓缺料报警 (ON)
///
[Description("No.5料仓缺料报警")]
[IsError()]
public bool IsErrorOfLack_5{ get; set; }
///
/// No.6料仓缺料报警 (ON)
///
[Description("No.6料仓缺料报警")]
[IsError()]
public bool IsErrorOfLack_6{ get; set; }
///
/// No.1料斗加料异常 (ON)
///
[Description("No.1料斗加料异常")]
[IsError()]
public bool IsErrorOfAdd_1{ get; set; }
///
/// No.2料斗加料异常 (ON)
///
[Description("No.2料斗加料异常")]
[IsError()]
public bool IsErrorOfAdd_2{ get; set; }
///
/// No.3料斗加料异常 (ON)
///
[Description("No.3料斗加料异常")]
[IsError()]
public bool IsErrorOfAdd_3{ get; set; }
///
/// No.4料斗加料异常 (ON)
///
[Description("No.4料斗加料异常")]
[IsError()]
public bool IsErrorOfAdd_4{ get; set; }
///
/// No.5料斗加料异常 (ON)
///
[Description("No.5料斗加料异常")]
[IsError()]
public bool IsErrorOfAdd_5{ get; set; }
///
/// No.6料斗加料异常 (ON)
///
[Description("No.6料斗加料异常")]
[IsError()]
public bool IsErrorOfAdd_6{ get; set; }
///
/// 螺杆缺料报警 (ON)
///
[Description("螺杆缺料报警")]
[IsError()]
public bool IsErrorOfScrewLack{ get; set; }
///
/// 螺杆流量超偏差报警 (ON)
///
[Description("螺杆流量超偏差报警")]
[IsError()]
public bool IsErrorOfScrewFlow{ get; set; }
///
/// 搅拌电机故障 (ON)
///
[Description("搅拌电机故障")]
[IsError()]
public bool IsErrorOfBlender{ get; set; }
///
/// 急停开启 (ON)
///
[Description("急停开启")]
[IsError()]
public bool IsErrorOfScram{ get; set; }
///
/// 搅拌电机急停开启 (ON)
///
[Description("搅拌电机急停开启")]
[IsError()]
public bool IsErrorOfBlender2{ get; set; }
///
/// 搅拌电机未启动 (ON)
///
[Description("搅拌电机未启动")]
[IsError()]
public bool IsErrorOfBlender3{ get; set; }
#endregion
public void BinsReBinding(int bincnt)
{
BinCnt = bincnt;
BinsBinding();
}
///
/// 料仓,混料参数 绑定到 对应的队列
///
void BinsBinding()
{
Ingredients.Clear();
for (int i = 0; i < BinCnt; i++)
{
int no = i + 1;
IngredientCell ingredient = new IngredientCell();
ingredient.Number = no.ToString();
Misc.BindingOperations.SetBinding(this, $"MixPSet_{no}", ingredient, "MixPSet", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MixPDisp_{no}", ingredient, "MixPDisp", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MixCumPercent_{no}", ingredient, "MixCumPercent", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MixSet_{no}", ingredient, "MixSet", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MixDisp_{no}", ingredient, "MixDisp", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MixCum_{no}", ingredient, "MixCum", Misc.BindingOperations.BindingMode.TwoWay);
Ingredients.Add(ingredient);
}
IngredientParams.Clear();
for (int i = 0; i < BinCnt; i++)
{
int no = i + 1;
IngredientParamCell ingredientParam = new IngredientParamCell();
ingredientParam.Number = no.ToString();
Misc.BindingOperations.SetBinding(this, $"FeedingDeviation_{no}", ingredientParam, "FeedingDeviation", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"FeedSet_{no}", ingredientParam, "FeedSet", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"InitTime_{no}", ingredientParam, "InitTime", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"MinTime_{no}", ingredientParam, "MinTime", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"StableTime_{no}", ingredientParam, "StableTime", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(this, $"BinAlarmSet_{no}", ingredientParam, "BinAlarmSet", Misc.BindingOperations.BindingMode.TwoWay);
IngredientParams.Add(ingredientParam);
}
}
public string[] GetSyncPropNames()
{
return null;
}
public string[] GetNoSyncPropNames()
{
return new string[] {
"Number",
"Color",
"BinCnt",
"Ingredients",
"IngredientParams"
};
}
#region 混料料仓队列
public List Ingredients { get; } = new List();
#endregion
#region 混料参数队列
public List IngredientParams { get; } = new List();
#endregion
}
public class IngredientCell : INotifyPropertyChanged
{
///
/// 颜色
///
public Brush Color { get; set; }
///
/// 序号
///
public string Number { get; set; }
///
/// 混料 进行中
///
public bool MixLight { get; set; }
private float mixPSet;
///
/// 比例设定
///
public float MixPSet { get; set; }
///
/// 比例显示
///
public float MixPDisp { get; set; }
///
/// 累计重量比例
///
public float MixCumPercent { get; set; }
///
/// 重量设定
///
public float MixSet { get; set; }
///
/// 重量显示
///
public float MixDisp { get; set; }
///
/// 累计重量
///
public float MixCum { get; set; }
public IngredientCell()
{
}
public event PropertyChangedEventHandler PropertyChanged;
}
public class IngredientParamCell : INotifyPropertyChanged
{
///
/// 序号
///
public string Number { get; set; }
///
/// 补料偏差
///
public float FeedingDeviation { get; set; }
///
/// 加料设定
///
public float FeedSet { get; set; }
///
/// 初始时间
///
public float InitTime { get; set; }
///
/// 最小时间
///
public float MinTime { get; set; }
///
/// 稳重时间
///
public float StableTime { get; set; }
///
/// 料仓报警设定
///
public float BinAlarmSet { get; set; }
public IngredientParamCell()
{
}
public event PropertyChangedEventHandler PropertyChanged;
}
}