/// <summary> /// 方案拷贝 /// </summary> /// <param name="FaItem"></param> public void Copy(ref CLDC_DataCore.Model.Plan.Plan_QianDong FaItem) { if (Chk_Glfx.CheckState == CheckState.Unchecked) { return; } StPlan_QianDong _Item = new StPlan_QianDong(); _Item.PowerFangXiang = this._Glfx; _Item.DefaultValue = this.Chk_Default.CheckState == CheckState.Checked ? 1 : 0; if (Rb_Zero.Checked) //不加电流 { _Item.FloatxIb = 0F; } else if (Rb_02xIb.Checked) //加1/5倍起动电流 { _Item.FloatxIb = 0.2F; } else if (Rb_025xIb.Checked) //加0.25倍起动电流 { _Item.FloatxIb = 0.25F; } if (Rb_AutoT.Checked) //规程算潜动时间 { _Item.xTime = 0F; } if (Rb_CustomT.Checked) //自定义潜动时间 { if (CLDC_DataCore.Function.Number.IsNumeric(Txt_T.Text)) //如果文本框潜动时间为数字 { _Item.xTime = float.Parse(Txt_T.Text); } else { _Item.xTime = 0F; //不为数字就按规程算 } } if (Chk_80.CheckState == CheckState.Checked) { FaItem.Add(_Item.PowerFangXiang, 0.8F, _Item.FloatxIb, _Item.xTime, _Item.DefaultValue); } if (Chk_90.CheckState == CheckState.Checked) { FaItem.Add(_Item.PowerFangXiang, 0.9F, _Item.FloatxIb, _Item.xTime, _Item.DefaultValue); } if (Chk_100.CheckState == CheckState.Checked) { FaItem.Add(_Item.PowerFangXiang, 1F, _Item.FloatxIb, _Item.xTime, _Item.DefaultValue); } if (Chk_110.CheckState == CheckState.Checked) { FaItem.Add(_Item.PowerFangXiang, 1.1F, _Item.FloatxIb, _Item.xTime, _Item.DefaultValue); } if (Chk_115.CheckState == CheckState.Checked) { FaItem.Add(_Item.PowerFangXiang, 1.15F, _Item.FloatxIb, _Item.xTime, _Item.DefaultValue); } }
private void CreateFaInfo() { int _FirstYaoJian = CLDC_MeterUI.UI_Detection_New.Main.GetFirstYaoJianMeterIndex(_DnbGroup); CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo _DnbInfo = _DnbGroup.MeterGroup[_FirstYaoJian]; _Ub = float.Parse(_DnbInfo.Mb_chrUb); //电压 _Ib = _DnbInfo.Mb_chrIb; //电流字符串 _Dj = _DnbInfo.Mb_chrBdj; //等级 有功(无功) _GuiCheng = _DnbInfo.GuiChengName; //使用的规程名称 _Const = _DnbInfo.Mb_chrBcs; //常数 _Znq = _DnbInfo.Mb_BlnZnq; //止逆器 _Hgq = _DnbInfo.Mb_BlnHgq; //互感器 _Clfs = (CLDC_Comm.Enum.Cus_Clfs)_DnbInfo.Mb_intClfs; //测量方式 for (int i = 0; i < _DnbGroup.CheckPlan.Count; i++) { if (!(_DnbGroup.CheckPlan[i] is StPlan_QianDong)) { continue; } StPlan_QianDong _Item = (StPlan_QianDong)_DnbGroup.CheckPlan[i]; int _RowIndex = Dgv_QianDong.Rows.Add(); Dgv_QianDong.Rows[_RowIndex].HeaderCell.Value = _Item.ToString(); Dgv_QianDong.Rows[_RowIndex].Tag = i; Dgv_QianDong.Rows[_RowIndex].Cells[0].Value = _Item.PowerFangXiang.ToString(); Dgv_QianDong.Rows[_RowIndex].Cells[1].Value = _Item.FloatxU * 100F; //电压倍数 Dgv_QianDong.Rows[_RowIndex].Cells[1].Tag = Dgv_QianDong.Rows[_RowIndex].Cells[1].Value; //电压倍数副本 Dgv_QianDong.Rows[_RowIndex].Cells[2].Value = _Item.FloatxIb; //潜动电流+多少倍起动电流 Dgv_QianDong.Rows[_RowIndex].Cells[2].Tag = Dgv_QianDong.Rows[_RowIndex].Cells[2].Value; _Item.CheckTimeAndIb(_GuiCheng, _Clfs, _Ub, _Ib, _Dj, _Const, _Znq, _Hgq); //计算潜动电流和潜动时间 Dgv_QianDong.Rows[_RowIndex].Cells[3].Value = _Item.FloatIb; //潜动电流 Dgv_QianDong.Rows[_RowIndex].Cells[4].Value = Math.Round(_Item.CheckTime, 1); //潜动时间 Dgv_QianDong.Rows[_RowIndex].Cells[4].Tag = Dgv_QianDong.Rows[_RowIndex].Cells[4].Value; //潜动时间副本 Dgv_QianDong.Rows[_RowIndex].Cells[5].Value = _Item.DefaultValue == 1 ? true : false; //是否默认合格 Dgv_QianDong.Rows[_RowIndex].Cells[5].Tag = Dgv_QianDong.Rows[_RowIndex].Cells[5].Value; //是否默认合格副本 } }
/// <summary> /// 编辑完成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dgv_QianDong_CellLeave(object sender, DataGridViewCellEventArgs e) { if (!Dgv_QianDong[e.ColumnIndex, e.RowIndex].ReadOnly) { if (Dgv_QianDong[e.ColumnIndex, e.RowIndex].Value == null) { Dgv_QianDong.EndEdit(); return; } string _TmpValue = Dgv_QianDong[e.ColumnIndex, e.RowIndex].Value.ToString(); Dgv_QianDong.EndEdit(); if (e.ColumnIndex != 5 && !CLDC_DataCore.Function.Number.IsNumeric(Dgv_QianDong[e.ColumnIndex, e.RowIndex].Value.ToString())) { Dgv_QianDong[e.ColumnIndex, e.RowIndex].Value = _TmpValue; return; } if (e.ColumnIndex == 1 || e.ColumnIndex == 2) { StPlan_QianDong _Item = (StPlan_QianDong)_DnbGroup.CheckPlan[(int)Dgv_QianDong.Rows[e.RowIndex].Tag]; _Item.FloatxU = float.Parse(Dgv_QianDong[1, e.RowIndex].Value.ToString()) / 100F; _Item.FloatxIb = float.Parse(Dgv_QianDong[2, e.RowIndex].Value.ToString()); _Item.CheckTimeAndIb(_GuiCheng, _Clfs, _Ub, _Ib, _Dj, _Const, _Znq, _Hgq); Dgv_QianDong[3, e.RowIndex].Value = _Item.FloatIb; Dgv_QianDong[4, e.RowIndex].Value = Math.Round(_Item.CheckTime, 1); Dgv_QianDong[4, e.RowIndex].Tag = Dgv_QianDong[4, e.RowIndex].Value; } } }
/// <summary> /// 加载潜动方案 /// </summary> private void Load() { _LstQianDong = new List <StPlan_QianDong>(); string _ErrorString = ""; XmlNode _XmlNode = clsXmlControl.LoadXml(_FAPath, out _ErrorString); if (_XmlNode == null) { DayCheckTimesSetting = "0|1|5|60"; return; } if (_XmlNode.ChildNodes.Count < 1) { DayCheckTimesSetting = "0|1|5|60"; } for (int _i = 0; _i < _XmlNode.ChildNodes.Count - 1; _i++) { StPlan_QianDong _Qiandong = new StPlan_QianDong(); _Qiandong.PowerFangXiang = (CLDC_Comm.Enum.Cus_PowerFangXiang) int.Parse(_XmlNode.ChildNodes[_i].Attributes["GLFX"].Value); _Qiandong.FloatxU = float.Parse(_XmlNode.ChildNodes[_i].Attributes["xU"].Value); _Qiandong.FloatxIb = float.Parse(_XmlNode.ChildNodes[_i].Attributes["xQIb"].Value); _Qiandong.xTime = float.Parse(_XmlNode.ChildNodes[_i].Attributes["xTime"].Value); _Qiandong.DefaultValue = int.Parse(_XmlNode.ChildNodes[_i].Attributes["Default"].Value); if (_XmlNode.ChildNodes.Count > 0) { try { if (_XmlNode.ChildNodes[_XmlNode.ChildNodes.Count - 1].OuterXml.Contains("PrjParameter")) { _Qiandong.DayCheckTimesSetting = _XmlNode.ChildNodes[_XmlNode.ChildNodes.Count - 1].Attributes["PrjParameter"].Value; DayCheckTimesSetting = _Qiandong.DayCheckTimesSetting; } else { _Qiandong.DayCheckTimesSetting = "0|1|5|60"; DayCheckTimesSetting = _Qiandong.DayCheckTimesSetting; } } catch (Exception ex) { CLDC_DataCore.Function.ErrorLog.Write(ex); _Qiandong.DayCheckTimesSetting = "0|1|5|60"; DayCheckTimesSetting = _Qiandong.DayCheckTimesSetting; } _LstQianDong.Add(_Qiandong); } } if (_LstQianDong.Count > 1) { DayCheckTimesSetting = _LstQianDong[_LstQianDong.Count - 1].DayCheckTimesSetting; } else { DayCheckTimesSetting = "0|1|5|60"; } return; }
/// <summary> /// 移动潜动项目 /// </summary> /// <param name="i">需要移动到的列表位置</param> /// <param name="Item">项目结构体</param> public void Move(int i, StPlan_QianDong Item) { i = i < 0 ? 0 : i; i = i >= _LstQianDong.Count ? _LstQianDong.Count - 1 : i; this.Remove(Item); _LstQianDong.Insert(i, Item); return; }
/// <summary> /// 根据项目移除 /// </summary> /// <param name="Item">项目结构体</param> public void Remove(StPlan_QianDong Item) { if (!_LstQianDong.Contains(Item)) { return; } _LstQianDong.Remove(Item); return; }
/// <summary> /// 增加一个潜动项目 /// </summary> /// <param name="Glfx">功率方向</param> /// <param name="xU">电压倍数(数字)</param> /// <param name="xIb">电流倍数(数字)</param> /// <param name="xTime">时间倍数(多少倍起动时间)起动时间是根据规程计算</param> /// <param name="Default">是否默认合格0-不默认,1-默认,默认合格时该项目则不检定</param> /// <returns></returns> public bool Add(Cus_PowerFangXiang Glfx, float xU, float xIb, float xTime, int DefaultValue) { StPlan_QianDong _QianDong = new StPlan_QianDong(); _QianDong.PowerFangXiang = Glfx; _QianDong.FloatxU = xU; _QianDong.FloatxIb = xIb; _QianDong.xTime = xTime; _QianDong.DefaultValue = DefaultValue; if (_LstQianDong.Contains(_QianDong)) { return(false); } _LstQianDong.Add(_QianDong); return(true); }
/// <summary> /// 检查方案项目参数是否被改变,如果改变就需要记录并准备下发 /// </summary> /// <returns></returns> public bool ChangeFAPram() { bool Changed = false; for (int i = 0; i < Dgv_QianDong.Rows.Count; i++) { bool PrjChanged = false; StPlan_QianDong _Item = (StPlan_QianDong)_DnbGroup.CheckPlan[(int)Dgv_QianDong.Rows[i].Tag]; if (Dgv_QianDong[1, i].Value != Dgv_QianDong[1, i].Tag) //不等就是有修改 { Changed = true; PrjChanged = true; _Item.FloatxU = float.Parse(Dgv_QianDong[1, i].Value.ToString()) / 100F; } if (Dgv_QianDong[2, i].Value != Dgv_QianDong[2, i].Tag) //不等就是有修改 { Changed = true; PrjChanged = true; _Item.FloatxIb = float.Parse(Dgv_QianDong[2, i].Value.ToString()); } if (Dgv_QianDong[4, i].Value != Dgv_QianDong[4, i].Tag) //不等就是有修改 { Changed = true; PrjChanged = true; _Item.xTime = float.Parse(Dgv_QianDong[4, i].Value.ToString()); } if (Dgv_QianDong[5, i].Value != Dgv_QianDong[5, i].Tag) //不等就是有修改 { Changed = true; PrjChanged = true; _Item.DefaultValue = (bool)Dgv_QianDong[5, i].Value == false ? 0 : 1; } if (PrjChanged) { _DnbGroup.CheckPlan.RemoveAt((int)Dgv_QianDong.Rows[i].Tag); _DnbGroup.CheckPlan.Insert((int)Dgv_QianDong.Rows[i].Tag, _Item); } } return(Changed); }
/// <summary> /// 创建方案,这个创建方案仅仅是创建方案项目列表,在09-7-2日以后使用 /// </summary> /// <returns></returns> public List <object> CreateFA(Model.DnbModel.DnbInfo.MeterBasicInfo mb_Info, ref string Ib, ref int Qs, ref string WcLimit) { List <object> CheckFaItem = new List <object>(); if (_Plan.Count == 0) { return(CheckFaItem); } for (int i = 0; i < _Plan.Count; i++) { StFAGroup _Item = _Plan[i]; switch (_Item.FAType) { case Cus_FAGroup.预先调试: //预热方案加载 Plan_PrepareTest _Pre = new Plan_PrepareTest(_TaiType, _Item.FAName); for (int j = 0; j < _Pre.Count; j++) { CheckFaItem.Add(_Pre.getDgnPrj(j)); } _Pre = null; break; case Cus_FAGroup.预热试验: //预热方案加载 Plan_YuRe _YuRe = new Plan_YuRe(_TaiType, _Item.FAName); for (int j = 0; j < _YuRe.Count; j++) { CheckFaItem.Add(_YuRe.getYuRePrj(j)); } _YuRe = null; break; case Cus_FAGroup.外观检查试验: //外观检查试验方案加载 Plan_WGJC _WGJC = new Plan_WGJC(_TaiType, _Item.FAName); for (int j = 0; j < _WGJC.Count; j++) { CheckFaItem.Add(_WGJC.getWGJCPrj(j)); } _WGJC = null; break; case Cus_FAGroup.起动试验: //启动方案项目加载 Plan_QiDong _QiDong = new Plan_QiDong(_TaiType, _Item.FAName); for (int j = 0; j < _QiDong.Count; j++) { StPlan_QiDong stQiD = _QiDong.getQiDongPrj(j); stQiD.CheckTimeAndIb(mb_Info.GuiChengName, CLDC_DataCore.Const.GlobalUnit.Clfs, CLDC_DataCore.Const.GlobalUnit.U, mb_Info.Mb_chrIb, mb_Info.Mb_chrBdj, mb_Info.Mb_chrBcs, mb_Info.Mb_BlnZnq, mb_Info.Mb_BlnHgq); CheckFaItem.Add(stQiD); } _QiDong = null; break; case Cus_FAGroup.潜动试验: //潜动项目方案加载 Plan_QianDong _QianDong = new Plan_QianDong(_TaiType, _Item.FAName); for (int j = 0; j < _QianDong.Count; j++) { StPlan_QianDong stQianD = _QianDong.getQianDongPrj(j); stQianD.CheckTimeAndIb(mb_Info.GuiChengName, CLDC_DataCore.Const.GlobalUnit.Clfs, CLDC_DataCore.Const.GlobalUnit.U, mb_Info.Mb_chrIb, mb_Info.Mb_chrBdj, mb_Info.Mb_chrBcs, mb_Info.Mb_BlnZnq, mb_Info.Mb_BlnHgq); CheckFaItem.Add(stQianD); } _QianDong = null; break; case Cus_FAGroup.基本误差试验: //基本误差试验方案加载 Plan_WcPoint _Wc = new Plan_WcPoint(_TaiType, _Item.FAName); Ib = _Wc.Qscz; Qs = _Wc.Czqs; WcLimit = _Wc.CzWcLimit; for (int j = 0; j < _Wc.Count; j++) { CheckFaItem.Add(_Wc.getCheckPoint(j)); } _Wc = null; break; case Cus_FAGroup.走字试验: //走字试验方案项目加载 Plan_ZouZi _Zouzi = new Plan_ZouZi(_TaiType, _Item.FAName); for (int j = 0; j < _Zouzi.Count; j++) { StPlan_ZouZi _ZouPrjPlan = _Zouzi.getZouZiPrj(j); for (int z = 0; z < _ZouPrjPlan.ZouZiPrj.Count; z++) { CheckFaItem.Add(_ZouPrjPlan.getNewPlan(z)); } } _Zouzi = null; break; case Cus_FAGroup.多功能试验: //多功能试验方案项目加载 Plan_Dgn _Dgn = new Plan_Dgn(_TaiType, _Item.FAName); for (int j = 0; j < _Dgn.Count; j++) { CheckFaItem.Add(_Dgn.getDgnPrj(j)); } _Dgn = null; break; case Cus_FAGroup.通讯协议检查试验: //通讯协议检查试验 Plan_ConnProtocolCheck _Cpc = new Plan_ConnProtocolCheck(_TaiType, _Item.FAName); for (int j = 0; j < _Cpc.Count; j++) { CheckFaItem.Add(_Cpc.getConnProtocolPrj(j)); } _Dgn = null; break; case Cus_FAGroup.影响量试验: Plan_Specal _Specal = new Plan_Specal(_TaiType, _Item.FAName); for (int j = 0; j < _Specal.Count; j++) { CheckFaItem.Add(_Specal.getSpecalPrj(j)); } _Specal = null; break; case Cus_FAGroup.载波试验: Plan_Carrier _ZaiBo = new Plan_Carrier(_TaiType, _Item.FAName); for (int j = 0; j < _ZaiBo.Count; j++) { CheckFaItem.Add(_ZaiBo.GetCarrierPrj(j)); } _ZaiBo = null; break; case Cus_FAGroup.误差一致性: Plan_ErrAccord _ErrAccord = new Plan_ErrAccord(_TaiType, _Item.FAName); for (int j = 0; j < _ErrAccord.Count; j++) { CheckFaItem.Add(_ErrAccord.getErrAccordPrj(j)); } _ErrAccord = null; break; case Cus_FAGroup.功耗试验: { Plan_PowerConsume _PowerConsume = new Plan_PowerConsume(_TaiType, _Item.FAName); for (int j = 0; j < _PowerConsume.Count; j++) { CheckFaItem.Add(_PowerConsume.getPowerConsumePrj(j)); } _PowerConsume = null; } break; case Cus_FAGroup.冻结功能试验: Plan_Freeze _Freeze = new Plan_Freeze(_TaiType, _Item.FAName); for (int j = 0; j < _Freeze.Count; j++) { CheckFaItem.Add(_Freeze.getFreezePrj(j)); } _Freeze = null; break; case Cus_FAGroup.费控功能试验: Plan_CostControl _CostControl = new Plan_CostControl(_TaiType, _Item.FAName); for (int j = 0; j < _CostControl.Count; j++) { CheckFaItem.Add(_CostControl.getCostControlPrj(j)); } _CostControl = null; break; case Cus_FAGroup.智能表功能试验: Plan_Function _Function = new Plan_Function(_TaiType, _Item.FAName); for (int j = 0; j < _Function.Count; j++) { CheckFaItem.Add(_Function.getFunctionPrj(j)); } _Function = null; break; case Cus_FAGroup.事件记录试验: Plan_EventLog _Eventlog = new Plan_EventLog(_TaiType, _Item.FAName); for (int j = 0; j < _Eventlog.Count; j++) { CheckFaItem.Add(_Eventlog.getEventLogPrj(j)); } _Eventlog = null; break; case Cus_FAGroup.数据转发试验: Plan_DataSendForRelay _DataSend = new Plan_DataSendForRelay(_TaiType, _Item.FAName); for (int j = 0; j < _DataSend.Count; j++) { CheckFaItem.Add(_DataSend.getDataSendForRelay(j)); } _DataSend = null; break; case Cus_FAGroup.工频耐压试验: Plan_Insulation planInsulation = new Plan_Insulation(_TaiType, _Item.FAName); for (int j = 0; j < planInsulation.Count; j++) { CheckFaItem.Add(planInsulation.GetPlan(j)); } planInsulation = null; break; case Cus_FAGroup.红外数据比对试验: Plan_Infrared planInfrared = new Plan_Infrared(_TaiType, _Item.FAName); for (int j = 0; j < planInfrared.Count; j++) { CheckFaItem.Add(planInfrared.GetCarrierPrj(j)); } planInfrared = null; break; case Cus_FAGroup.负荷记录试验: Plan_LoadRecord planA = new Plan_LoadRecord(_TaiType, _Item.FAName); for (int j = 0; j < planA.Count; j++) { CheckFaItem.Add(planA.GetCurrentPrj(j)); } planA = null; break; } } return(CheckFaItem); }
/// <summary> /// 方案加载 /// </summary> /// <param name="FaItem"></param> public void LoadFA(CLDC_DataCore.Model.Plan.Plan_QianDong FaItem) { this.ClearData(); for (int i = 0; i < FaItem.Count; i++) { StPlan_QianDong _Obj = FaItem.getQianDongPrj(i); if (_Obj.PowerFangXiang != _Glfx) { continue; } Chk_Glfx.CheckState = CheckState.Checked; Chk_Default.CheckState = _Obj.DefaultValue == 0 ? CheckState.Unchecked : CheckState.Checked; if (_Obj.FloatxU == 0.8F) { Chk_80.CheckState = CheckState.Checked; } else if (_Obj.FloatxU == 0.9F) { Chk_90.CheckState = CheckState.Checked; } else if (_Obj.FloatxU == 1.0F) { Chk_100.CheckState = CheckState.Checked; } else if (_Obj.FloatxU == 1.1F) { Chk_110.CheckState = CheckState.Checked; } else if (_Obj.FloatxU == 1.15F) { Chk_115.CheckState = CheckState.Checked; } if (_Obj.FloatxIb == 0) { Rb_Zero.Checked = true; } else if (_Obj.FloatxIb == 0.2F) { Rb_02xIb.Checked = true; } else if (_Obj.FloatxIb == 0.25F) { Rb_025xIb.Checked = true; } if (_Obj.xTime == 0F) { Rb_AutoT.Checked = true; } else { Rb_CustomT.Checked = true; Txt_T.Text = _Obj.xTime.ToString(); } } }