| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win.UltraWinToolbars;
- namespace Core.StlMes.Client.Mcp.Control.HeatTreatment
- {
- public partial class FrmChooseStandard : FrmBase
- {
- private readonly List<HttReportDefaultEntity> _listDefault;
- public FrmChooseStandard(List<HttReportDefaultEntity> listDefault, List<HttCrackDetectionStandardEntity> listProbe, OpeBase Ob)
- {
- InitializeComponent();
- ob = Ob;
- _listDefault = listDefault;
- listProbe.ForEach(p=>p.Chk = true);
- var ProDefault = _listDefault.Where(p => p.ReportColumn.ToUpper() == "STANDARD_NAME").ToList();
-
- if (ProDefault.Any() )
- {
- DataTable dt;
- if (ProDefault[0].DroplistUsed != "")
- {
- dt =
- ServerHelper.GetData(
- "com.steering.mes.mcp.heatTreatment.ScrapHelper.doQuery",
- new object[] {"4021", ProDefault[0].DroplistUsed.Split(';')}, ob);
- }
- else
- {
- dt =
- ServerHelper.GetData(
- "com.steering.mes.mcp.collarMaterial.ComBaseInfo.getBaseInfo",
- new object[] {"4021"}, ob);
- }
- Standard.DataSource = dt;
- Standard.ValueMember = "BASECODE";
- Standard.DisplayMember = "BASENAME";
- if (ProDefault[0].TextDefault != "")
- {
- DataTable dtDefault =
- ServerHelper.GetData(
- "com.steering.mes.mcp.heatTreatment.ScrapHelper.doQuery",
- new object[] { "4021", ProDefault[0].TextDefault.Split(';') }, ob);
- if (dtDefault.Rows.Count > 0)
- {
- foreach (DataRow row in dtDefault.Rows)
- {
- if (listProbe.All(p => p.StandardCode != row["BASECODE"].ToString2()))
- {
- listProbe.Add(new HttCrackDetectionStandardEntity()
- {
- StandardCode = row["BASECODE"].ToString2(),
- StandardName = row["BASENAME"].ToString2()
- });
- }
-
- }
- }
- }
- }
- httCrackDetectionStandardEntityBindingSource.DataSource = listProbe;
- }
- private void ultraToolbarsManager1_ToolClick(object sender, ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Save":
- Save();
- break;
- case "Close":
- CloseFrm();
- break;
- }
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- foreach (var ugc in ultraGridDetailDes1.DisplayLayout.Bands[0].Columns)
- ugc.SortIndicator = SortIndicator.Disabled;
- ultraGridDetailDes1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
- EntityHelper.ShowGridCaption<HttCrackDetectionStandardEntity>(ultraGridDetailDes1.DisplayLayout.Bands[0]);
- }
- private void CloseFrm()
- {
- DialogResult = DialogResult.Cancel;
- Close();
- }
- /// <summary>
- /// 保存可疑、剔除品
- /// </summary>
- private void Save()
- {
- ultraGridDetailDes1.UpdateData();
- List<HttCrackDetectionStandardEntity> list = GetValue();
- if (!list.Any())
- {
- MessageBox.Show("请选择探伤的标准");
- return;
- }
- if (list.Any(p => p.StandardCode == ""))
- {
- MessageBox.Show("探伤标准不能为空");
- return;
- }
-
- DialogResult = DialogResult.OK;
- }
- private void ultraGridDetailDes1_InitializeTemplateAddRow(object sender, Infragistics.Win.UltraWinGrid.InitializeTemplateAddRowEventArgs e)
- {
- if (ultraGridDetailDes1.ActiveRow == null && ultraGridDetailDes1.Rows.Count<=0)
- e.TemplateAddRow.Activated = true;
- }
- public List<HttCrackDetectionStandardEntity> GetValue()
- {
- ultraGridDetailDes1.UpdateData();
- List<HttCrackDetectionStandardEntity> data =
- httCrackDetectionStandardEntityBindingSource.DataSource as List<HttCrackDetectionStandardEntity>;
- if (data.Any())
- {
- return data.Where(p => p.Chk).ToList();
- }
- return new List<HttCrackDetectionStandardEntity>();
- }
- private void ultraGridDetailDes1_CellChange(object sender, CellEventArgs e)
- {
- ultraGridDetailDes1.UpdateData();
- if (e.Cell.Column.Key == "StandardCode")
- {
- HttCrackDetectionStandardEntity HttCrackDetectionStandardEntity =
- e.Cell.Row.ListObject as HttCrackDetectionStandardEntity;
- if (HttCrackDetectionStandardEntity == null) return;
- HttCrackDetectionStandardEntity.StandardName = e.Cell.Text;
- }
- }
- }
- }
|