using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Qcm.model; using CoreFS.CA06; using Infragistics.Win.UltraWinEditors; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; using System.Data; using System.Drawing; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm { public partial class FrmBaseSample : FrmBase { public FrmBaseSample() { InitializeComponent(); this.IsLoadUserView = true; } public void PopupLoad(string customInfo, OpeBase ob) { this.CustomInfo = customInfo; this.ob = ob; this._ob = ob; this.OnLoad(EventArgs.Empty); } private OpeBase _ob; public OpeBase Ob { get { return _ob; } set { _ob = value; } } private string phycode = ""; //取样码 public string Phycode { get { return phycode; } set { phycode = value; } } private string phydesc; //取样码描述 public string Phydesc { get { return phydesc; } set { phydesc = value; } } private string stdcode; //标准码 public string Stdcode { get { return stdcode; } set { stdcode = value; } } private string stddesc; //标准名称 public string Stddesc { get { return stddesc; } set { stddesc = value; } } private FrmPhySample fhs; public FrmPhySample Fhs { get { return fhs; } set { fhs = value; } } ArrayList parms = new ArrayList(); //新增参数 private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue) { //初始化编辑区域下拉框 DataTable dt = ServerHelper.GetData(MethodId, null, this._ob); if (dt != null && dt.Rows.Count > 0) { uce.DataSource = dt; uce.ValueMember = memberValue; } } private void FrmBaseSample_Load(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (_ob == null) { _ob = ob; } InitCombo(); doQuery(); } finally { this.Cursor = Cursors.Default; } } public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "查询": doQuery(); break; case "ButtonTool1": doSave(); break; case "ButtonTool2": doRefresh(); break; case "ButtonTool3": if (MessageBox.Show("确认关闭本窗口?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) this.Close(); break; case "ButtonTool4": DeleteOrResume(true); break; case "ButtonTool5": DeleteOrResume(false); break; } } private void InitCombo() { initJGDropDown(ultraComboEditor1, "com.steering.pss.qcm.CoreBaseSample.GetPhyLength", "BASECODE"); ClsBaseInfo.FillComBaseInfo(ultraComboEditor2, "4086", _ob, false); initJGDropDown(ultraComboEditor3, "com.steering.pss.qcm.CoreBaseSample.GetPhyPosition", "BASECODE"); ClsBaseInfo.FillComBaseInfo(ultraComboEditor5, "4081", _ob, false); QcmBaseQuery.NitializeStandardGX(ultraComboEditor4, true, _ob); ClsBaseInfo.FillComBaseInfo(ultraComboEditor9, "4099", _ob, false); //ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE"].EditorComponent= ultraComboEditor4; //ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; } private void AutoColSize() { UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"] }; GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col); } public void doQuery() { try { this.Cursor = Cursors.WaitCursor; string validflag = ultraCheckEditor1.Checked ? "0" : "1"; string phyMinName = labelTextBox1.Checked ? labelTextBox1.Text.Trim() : ""; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreBaseSample.Query", new Object[] { this.Phycode, phyMinName, validflag }, this._ob); GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true); foreach (UltraGridRow row in this.ultraGrid1.Rows) { ControlEdit(row); if (row.Cells["RATE"].Value.ToString() != "408602") { row.Cells["BATCH_CNT"].Value = ""; row.Cells["BATCH_UNIT"].Value = ""; row.Cells["BATCH_CNT"].Activation = Activation.ActivateOnly; row.Cells["BATCH_UNIT"].Activation = Activation.ActivateOnly; } else { row.Cells["BATCH_CNT"].Activation = Activation.AllowEdit; row.Cells["BATCH_UNIT"].Activation = Activation.AllowEdit; } if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效")) { row.Appearance.ForeColor = Color.Red; } else { row.Appearance.ForeColor = Color.Black; } } ultraGrid1.UpdateData(); } finally { this.Cursor = Cursors.Default; } } private void doSave() { if (GetGridData() == false) return; if (parms.Count <= 0) { MessageUtil.ShowWarning("请选择记录!"); return; } if (MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } this.ob = this.Ob; CoreClientParam ccp = new CoreClientParam(); //CoreClientParam是平台用来向服务端传递存放所有相关参数信息的。 ccp.ServerName = "com.steering.pss.qcm.CoreBaseSample"; //服务名指的是服务端的包名+类名 ccp.MethodName = "doSave"; //方法名指的是服务名指定类里的方法 ccp.ServerParams = new object[] { parms };//服务端方法的参数 //ExecuteNonQuery主要用来执行添加、修改、删除、存储过程的操作。 ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); doQuery(); // this.Close(); } private void doRefresh() { InitCombo(); AutoColSize(); } private void DeleteOrResume(bool flag) { this.ultraGrid1.UpdateData(); int ischeck = 0; ArrayList parms = new ArrayList(); foreach (UltraGridRow row in ultraGrid1.Rows) { if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE") { ischeck += 1; if (row.Cells["VALIDFLAG"].Value.ToString() == "无效") { if (flag) { MessageBox.Show("无效数据,无法作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); row.Activate(); return; } } if (row.Cells["VALIDFLAG"].Value.ToString() == "有效") { if (flag == false) { MessageBox.Show("有效数据,无法恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); row.Activate(); return; } } parms.Add(row.Cells["SIC"].Value.ToString()); } } if (ischeck == 0) { MessageBox.Show("请选择你要" + (flag ? "作废" : "恢复") + "的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBox.Show("确认要" + (flag ? "作废" : "恢复") + "选择的记录", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.No) return; this.ob = this.Ob; CoreClientParam ccp = new CoreClientParam(); //CoreClientParam是平台用来向服务端传递存放所有相关参数信息的。 ccp.ServerName = "com.steering.pss.qcm.CoreBaseSample"; //服务名指的是服务端的包名+类名 ccp.MethodName = "DeleteOrResume"; //方法名指的是服务名指定类里的方法 ccp.ServerParams = new object[] { parms, flag, this.UserInfo.GetUserName() };//服务端方法的参数 //ExecuteNonQuery主要用来执行添加、修改、删除、存储过程的操作。 ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageBox.Show("数据" + (flag ? "作废" : "恢复") + "成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); doQuery(); } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { if (e.Tool.Key == "查询") { doQuery(); } if (e.Tool.Key == "ButtonTool1") //保存 { doSave(); } if (e.Tool.Key == "ButtonTool2") //刷新 { doRefresh(); } if (e.Tool.Key == "ButtonTool3") //关闭 { if (MessageBox.Show("确认关闭本窗口?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) this.Close(); } if (e.Tool.Key == "ButtonTool4") //删除 { DeleteOrResume(true); } if (e.Tool.Key == "ButtonTool5") //恢复 { DeleteOrResume(false); } } private void ultraGrid1_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e) { UltraGridRow ugr = this.ultraGrid1.ActiveRow; string sic = ""; //sic码 string sicd = ""; //最终的sic码 DataRow[] dr = dataTable1.Select("", "SIC DESC"); if (dr.Length > 0) { sic = dr[0]["SIC"].ToString(); } if (sic == "") { sicd = this.Phycode + string.Format("{0:000}", 1); } else { int index = int.Parse(sic.Substring(5, 3)); index += 1; sicd = this.Phycode + string.Format("{0:000}", index); } ugr.Cells["PHY_CODE_MIN"].Value = this.Phycode; ugr.Cells["PHY_NAME_MIN"].Value = this.Phydesc; ugr.Cells["STD_CODE"].Value = ""; ugr.Cells["SIC"].Value = sicd; ugr.Cells["SAMPLE_COUNT"].Value = LoadPhySmpCnt(); if (!ugr.GetValue("PHY_NAME_MIN").StartsWith("SSC")) { ugr.Cells["SSC_CONDITION"].Value = "409901"; } //e.Row.Cells["STEEL_SELECT"].Value = "选择"; } private string LoadPhySmpCnt() { try { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreBaseSample.loadPhySmpCnt", new object[] { phycode }, Ob); return dt.Rows[0][0].ToString(); } catch { } return ""; } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { ultraGrid1.UpdateData(); ControlEdit(e.Cell.Row); if (e.Cell.Row.Cells["RATE"].Value.ToString() != "408602" && e.Cell.Row.Cells["RATE"].Value.ToString() != "408608") { e.Cell.Row.Cells["BATCH_CNT"].Value = ""; e.Cell.Row.Cells["BATCH_UNIT"].Value = ""; e.Cell.Row.Cells["BATCH_CNT"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["BATCH_UNIT"].Activation = Activation.ActivateOnly; } else { e.Cell.Row.Cells["BATCH_CNT"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["BATCH_UNIT"].Activation = Activation.AllowEdit; } if (e.Cell.Row.GetText("RATE").Contains("生产批")) { e.Cell.Row.Cells["TOP_STOVE"].Activation = Activation.AllowEdit; e.Cell.Row.Cells["LOOP_VALUE"].Activation = Activation.AllowEdit; } else { e.Cell.Row.Cells["TOP_STOVE"].Value = ""; e.Cell.Row.Cells["LOOP_VALUE"].Value = ""; e.Cell.Row.Cells["TOP_STOVE"].Activation = Activation.ActivateOnly; e.Cell.Row.Cells["LOOP_VALUE"].Activation = Activation.ActivateOnly; } if (e.Cell.Column.Key == "ATTACH_PERCENT" || e.Cell.Column.Key == "ATTACH_COUNT") { e.Cell.Row.Cells["DESC_COUNT"].Value = ""; } if (e.Cell.Column.Key == "DESC_COUNT") { e.Cell.Row.Cells["ATTACH_PERCENT"].Value = ""; e.Cell.Row.Cells["ATTACH_COUNT"].Value = ""; } e.Cell.Row.Update(); } private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e) { UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (e.Cell.Column.Key.Equals("DESC_LENGTH")) { if (ugr.Cells["DESC_LENGTH"].Value.ToString() != "") { this.ultraComboEditor1.Text = ugr.Cells["DESC_LENGTH"].Text.ToString(); ugr.Cells["LENGTH"].Value = this.ultraComboEditor1.Value.ToString(); } } if (e.Cell.Column.Key.Equals("DESC_POSITION")) { if (ugr.Cells["DESC_POSITION"].Value.ToString() != "") { this.ultraComboEditor3.Text = ugr.Cells["DESC_POSITION"].Text.ToString(); ugr.Cells["POSITION"].Value = this.ultraComboEditor3.Value.ToString(); } } } private bool GetGridData() { this.ultraGrid1.UpdateData(); parms.Clear(); foreach (UltraGridRow row in ultraGrid1.Rows) { if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE") //勾选 { ArrayList listAdd = new ArrayList(); ArrayList listUpdate = new ArrayList(); if (row.Cells["RATE"].Value.ToString() == "") { MessageBox.Show("请选择取样频率", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); row.Cells["RATE"].Activate(); return false; } if (row.Cells["RATE"].Value.ToString() == "408602" || row.Cells["RATE"].Value.ToString() == "408608")// 检验批和生产批(检验批) { if (row.Cells["BATCH_UNIT"].Text == "") { MessageUtil.ShowWarning("请选择分批单位!"); row.Cells["BATCH_UNIT"].Activate(); return false; } else if (row.Cells["BATCH_CNT"].Text == "") { MessageUtil.ShowWarning("请输入分批数量!"); row.Cells["BATCH_CNT"].Activate(); return false; } } if (row.Cells["POSITION"].Value.ToString() == "") { MessageBox.Show("请选择取样位置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); row.Cells["POSITION"].Activate(); return false; } if (row.Cells["DESC_COUNT"].Value.ToString() == "" && row.Cells["ATTACH_PERCENT"].Value.ToString() == "") { MessageBox.Show("请输入管头个数或百分比%", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); row.Cells["DESC_COUNT"].Activate(); return false; } if (row.GetValue("SAMPLE_COUNT") == "") { MessageUtil.ShowWarning("请输入样条个数!"); row.SetCellActive("SAMPLE_COUNT"); return false; } if (row.GetValue("ATTACH_COUNT") != "" && row.GetValue("ATTACH_PERCENT") == "" ) { MessageUtil.ShowWarning("min支不为空,请输入百分比%"); row.SetCellActive("ATTACH_PERCENT"); return false; } if (row.GetValue("ATTACH_PERCENT") != "" && row.GetValue("ATTACH_COUNT") == "") { MessageUtil.ShowWarning("百分比%不为空,请输入min支"); row.SetCellActive("ATTACH_COUNT"); return false; } if (row.GetText("RATE").Contains("生产批")) { if (row.GetValue("TOP_STOVE") == "") { MessageUtil.ShowWarning("请输入头几炉!"); row.SetCellActive("TOP_STOVE"); return false; } if (row.GetValue("LOOP_VALUE") == "") { MessageUtil.ShowWarning("请输入循环值!"); row.SetCellActive("LOOP_VALUE"); return false; } } if (row.GetValue("EXCLUDE_PHY_MIN").Split(';').Length > 3) { MessageUtil.ShowWarning("材料号排它最多只能选择3个试样组!"); row.SetCellActive("EXCLUDE_PHY_MIN_NAME"); return false; } if (row.GetValue("PHY_NAME_MIN").StartsWith("SSC") && row.GetValue("SSC_CONDITION") == "") { MessageUtil.ShowWarning("请选择SSC+!"); row.SetCellActive("SSC_CONDITION"); return false; } //if (row.GetValue("MIN_D") != "" && row.GetValue("MIN_D_SIGN") == "") //{ // MessageUtil.ShowWarning("请选择适用外径下限符号!"); // row.SetCellActive("MIN_D_SIGN"); // return false; //} //if (row.GetValue("MIN_D") == "" && row.GetValue("MIN_D_SIGN") != "") //{ // MessageUtil.ShowWarning("请输入使用外径下限值!"); // row.SetCellActive("MIN_D"); // return false; //} //if (row.GetValue("MAX_D") != "" && row.GetValue("MAX_D_SIGN") == "") //{ // MessageUtil.ShowWarning("请选择适用外径上限符号!"); // row.SetCellActive("MAX_D_SIGN"); // return false; //} //if (row.GetValue("MAX_D") == "" && row.GetValue("MAX_D_SIGN") != "") //{ // MessageUtil.ShowWarning("请输入适用外径上限值!"); // row.SetCellActive("MAX_D"); // return false; //} //if (row.GetValue("MIN_D_SIGN") != "=") //{ // if (row.GetValue("MIN_H") != "" && row.GetValue("MIN_H_SIGN") == "") // { // MessageUtil.ShowWarning("请选择适用壁厚下限符号!"); // row.SetCellActive("MIN_H_SIGN"); // return false; // } // if (row.GetValue("MIN_H") == "" && row.GetValue("MIN_H_SIGN") != "") // { // MessageUtil.ShowWarning("请输入适用壁厚下限值!"); // row.SetCellActive("MIN_H"); // return false; // } // if (row.GetValue("MAX_H") != "" && row.GetValue("MAX_H_SIGN") == "") // { // MessageUtil.ShowWarning("请选择适用壁厚上限符号!"); // row.SetCellActive("MAX_H_SIGN"); // return false; // } // if (row.GetValue("MAX_H") == "" && row.GetValue("MAX_H_SIGN") != "") // { // MessageUtil.ShowWarning("请输入适用壁厚上限值!"); // row.SetCellActive("MAX_H"); // return false; // } //} //else //{ // if (row.GetValue("MAX_D") != "") // { // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用外径上限值!"); // row.SetCellActive("MAX_D"); // return false; // } // else if (row.GetValue("MAX_D_SIGN") != "") // { // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用外径上限符号!"); // row.SetCellActive("MAX_D_SIGN"); // return false; // } // else if (row.GetValue("MIN_H") != "") // { // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用壁厚下限值!"); // row.SetCellActive("MIN_H"); // return false; // } // else if (row.GetValue("MIN_H_SIGN") != "") // { // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用壁厚下限符号!"); // row.SetCellActive("MIN_H_SIGN"); // return false; // } // else if (row.GetValue("MAX_H") != "") // { // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用壁厚上限值!"); // row.SetCellActive("MAX_H"); // return false; // } // else if (row.GetValue("MAX_H_SIGN") != "") // { // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用壁厚上限符号!"); // row.SetCellActive("MAX_H_SIGN"); // return false; // } //} //if (row.GetValue("MIN_D") != "" && row.GetValue("MAX_D") != "") //{ // if (decimal.Parse(row.GetValue("MIN_D")) > decimal.Parse(row.GetValue("MAX_D"))) // { // MessageUtil.ShowWarning("适用外径下限值不能大于上限值!"); // row.SetCellActive("MIN_D"); // return false; // } // else if (decimal.Parse(row.GetValue("MIN_D")) == decimal.Parse(row.GetValue("MAX_D"))) // { // MessageUtil.ShowWarning("适用外径下限值和上限值相等时,下限符号只能选>=,上限符号只能选<=!"); // row.SetCellActive("MIN_D_SIGN"); // return false; // } //} //if (row.GetValue("MIN_H") != "" && row.GetValue("MAX_H") != "") //{ // if (decimal.Parse(row.GetValue("MIN_H")) > decimal.Parse(row.GetValue("MAX_H"))) // { // MessageUtil.ShowWarning("适用壁厚下限值不能大于上限值!"); // row.SetCellActive("MIN_H"); // return false; // } // else if (decimal.Parse(row.GetValue("MIN_H")) == decimal.Parse(row.GetValue("MAX_H"))) // { // MessageUtil.ShowWarning("适用壁厚下限值和上限值相等时,下限符号只能选>=,上限符号只能选<=!"); // row.SetCellActive("MIN_H_SIGN"); // return false; // } //} if (row.GetValue("MIN_D_SIGN") != "" && row.GetValue("MIN_D") == "") { MessageUtil.ShowWarning("请输入外径下限值!"); row.SetCellActive("MIN_D"); return false; } else if (row.GetValue("MIN_D_SIGN") == "" && row.GetValue("MIN_D") != "") { MessageUtil.ShowWarning("请选择外径下限符号!"); row.SetCellActive("MIN_D_SIGN"); return false; } else if (row.GetValue("MAX_D_SIGN") != "" && row.GetValue("MAX_D") == "") { MessageUtil.ShowWarning("请输入外径上限值!"); row.SetCellActive("MAX_D"); return false; } else if (row.GetValue("MAX_D_SIGN") == "" && row.GetValue("MAX_D") != "") { MessageUtil.ShowWarning("请选择外径上限符号!"); row.SetCellActive("MAX_D_SIGN"); return false; } else if (row.GetValue("MIN_H_SIGN") != "" && row.GetValue("MIN_H") == "") { MessageUtil.ShowWarning("请输入壁厚下限值!"); row.SetCellActive("MIN_H"); return false; } else if (row.GetValue("MIN_H_SIGN") == "" && row.GetValue("MIN_H") != "") { MessageUtil.ShowWarning("请选择壁厚下限符号!"); row.SetCellActive("MIN_H_SIGN"); return false; } else if (row.GetValue("MAX_H_SIGN") != "" && row.GetValue("MAX_H") == "") { MessageUtil.ShowWarning("请输入壁厚上限值!"); row.SetCellActive("MAX_H"); return false; } else if (row.GetValue("MAX_H_SIGN") == "" && row.GetValue("MAX_H") != "") { MessageUtil.ShowWarning("请选择壁厚上限符号!"); row.SetCellActive("MAX_H_SIGN"); return false; } else if (row.GetValue("MIN_D_SIGN") == "=" && row.GetValue("MAX_D_SIGN") != "") { MessageUtil.ShowWarning("外径下限符号为等号时,不能存在外径上限符号和外径上限值!"); row.SetCellActive("MAX_D_SIGN"); return false; } else if (row.GetValue("MIN_H_SIGN") == "=" && row.GetValue("MAX_H_SIGN") != "") { MessageUtil.ShowWarning("壁厚下限符号为等号时,不能存在壁厚上限符号和壁厚上限值!"); row.SetCellActive("MAX_H_SIGN"); return false; } else if (row.GetValue("MIN_D") != "" && row.GetValue("MAX_D") != "" && decimal.Parse(row.GetValue("MIN_D")) >= decimal.Parse(row.GetValue("MAX_D"))) { MessageUtil.ShowWarning("外径下限值不能大于等于外径上限值!"); row.SetCellActive("MIN_D"); return false; } else if (row.GetValue("MIN_H") != "" && row.GetValue("MAX_H") != "" && decimal.Parse(row.GetValue("MIN_H")) >= decimal.Parse(row.GetValue("MAX_H"))) { MessageUtil.ShowWarning("壁厚下限值不能大于等于壁厚上限值!"); row.SetCellActive("MIN_H"); return false; } ComBaseSampleEntity baseSampleEntity = new ComBaseSampleEntity(); baseSampleEntity.Sic = row.GetValue("SIC"); baseSampleEntity.PhyCodeMin = row.GetValue("PHY_CODE_MIN"); baseSampleEntity.PhyNameMin = row.GetValue("PHY_NAME_MIN"); baseSampleEntity.StdCode = row.GetValue("STD_CODE"); baseSampleEntity.StdName = row.GetValue("STD_NAME"); baseSampleEntity.Length = row.GetValue("LENGTH"); baseSampleEntity.DescLength = row.GetText("DESC_LENGTH"); baseSampleEntity.Rate = row.GetValue("RATE"); baseSampleEntity.DescRate = row.GetText("RATE"); if (row.GetValue("DESC_COUNT") != "") { baseSampleEntity.DescCount = decimal.Parse(row.GetValue("DESC_COUNT")); } baseSampleEntity.Position = row.GetValue("POSITION"); baseSampleEntity.DescPosition = row.GetText("POSITION"); baseSampleEntity.CreateName = this.UserInfo.GetUserName(); baseSampleEntity.Memo = row.GetValue("MEMO"); baseSampleEntity.SampleCount = decimal.Parse(row.GetValue("SAMPLE_COUNT")); baseSampleEntity.SampleStyle = row.GetValue("SAMPLE_STYLE"); if (row.GetValue("WIDTH") == "") { baseSampleEntity.Width = null; } else { baseSampleEntity.Width = decimal.Parse(row.GetValue("WIDTH")); } baseSampleEntity.MinD = row.GetValue("MIN_D"); baseSampleEntity.MinDSign = row.GetValue("MIN_D_SIGN"); baseSampleEntity.MaxD = row.GetValue("MAX_D"); baseSampleEntity.MaxDSign = row.GetValue("MAX_D_SIGN"); baseSampleEntity.MinH = row.GetValue("MIN_H"); baseSampleEntity.MinHSign = row.GetValue("MIN_H_SIGN"); baseSampleEntity.MaxH = row.GetValue("MAX_H"); baseSampleEntity.MaxHSign = row.GetValue("MAX_H_SIGN"); baseSampleEntity.SteelCode = row.GetValue("STEELCODE"); baseSampleEntity.SteelName = row.GetValue("STEELNAME"); baseSampleEntity.Produccode = row.GetValue("PRODUCCODE"); baseSampleEntity.Producname = row.GetValue("PRODUCNAME"); baseSampleEntity.Validflag = row.GetValue("VALIDFLAG"); baseSampleEntity.BatchCnt = row.GetValue("BATCH_CNT"); baseSampleEntity.BatchUnit = row.GetValue("BATCH_UNIT"); baseSampleEntity.AttachPercent = row.GetValue("ATTACH_PERCENT"); baseSampleEntity.AttachCount = row.GetValue("ATTACH_COUNT"); baseSampleEntity.TopStove = row.GetValue("TOP_STOVE"); baseSampleEntity.LoopValue = row.GetValue("LOOP_VALUE"); baseSampleEntity.SscCondition = row.GetValue("SSC_CONDITION"); baseSampleEntity.ExcludePhyMin = row.GetValue("EXCLUDE_PHY_MIN"); parms.Add(JSONFormat.Format(baseSampleEntity)); } } return true; } private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { } private void ControlEdit(UltraGridRow row) { ultraGrid1.UpdateData(); if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE") { for (int j = 0; j < row.Cells.Count; j++) { string key = row.Cells[j].Column.Key; if (key == "DESC_LENGTH" || key == "RATE" || key == "POSITION" || key == "DESC_COUNT" || key == "CHK" || key == "SAMPLE_COUNT" || key == "STD_CODE" || key == "SAMPLE_STYLE" || key == "WIDTH" || key == "MIN_D" || key == "MAX_D" || key == "MIN_H" || key == "MAX_H" || key == "MIN_D_SIGN" || key == "MAX_D_SIGN" || key == "MIN_H_SIGN" || key == "MAX_H_SIGN" || key == "STEEL_SELECT" || key == "BATCH_CNT" || key == "BATCH_UNIT" || key == "MEMO" || key == "ATTACH_PERCENT" || key == "ATTACH_COUNT" || key == "TOP_STOVE" || key == "LOOP_VALUE" || key == "SSC_CONDITION") { row.Cells[j].Activation = Activation.AllowEdit; } else { row.Cells[j].Activation = Activation.ActivateOnly; } } } else { for (int j = 0; j < row.Cells.Count; j++) { string key = row.Cells[j].Column.Key; if (key != "CHK") { row.Cells[j].Activation = Activation.ActivateOnly; } } } } private void ultraTextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e) { var actRow = ultraGrid1.ActiveRow; if (ultraGrid1.ActiveCell.Column.Key == "STD_NAME") { string stdCodes = actRow.GetValue("STD_CODE"); string[] styles = new string[] { "G", "X", "N" }; //if(this.CustomInfo == "2") //{ // styles = new string[] { "N" }; //} //else //{ // styles = new string[] { "G", "X" }; //} ComBaseStdChoice baseStdChoice = new ComBaseStdChoice(styles, stdCodes, _ob); if (baseStdChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK) { actRow.SetValue("STD_CODE", baseStdChoice.ChoiceStdCodes); actRow.SetValue("STD_NAME", baseStdChoice.ChoiceStdNames); } } else if (ultraGrid1.ActiveCell.Column.Key == "STEELNAME") { FrmRepSteel frms = new FrmRepSteel(); frms.Ob1 = this._ob; frms.Code = ultraGrid1.ActiveRow.GetValue("STEELCODE"); if (frms.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ultraGrid1.ActiveRow.SetValue("STEELCODE", frms.Code); ultraGrid1.ActiveRow.SetValue("STEELNAME", frms.Desc); } } else if (ultraGrid1.ActiveCell.Column.Key == "PRODUCNAME") { this.Cursor = Cursors.WaitCursor; PopupProductName popupProductName = new PopupProductName(actRow.GetValue("PRODUCCODE"), _ob); this.Cursor = Cursors.Default; if (popupProductName.ShowDialog() == DialogResult.OK) { actRow.SetValue("PRODUCCODE", popupProductName.ProductCodes); actRow.SetValue("PRODUCNAME", popupProductName.ProductNames); } } else if (ultraGrid1.ActiveCell.Column.Key == "EXCLUDE_PHY_MIN_NAME") { string phyMins = actRow.GetValue("EXCLUDE_PHY_MIN"); string[] styles = new string[] { "G", "X", "N" }; ComBasePhyMinChoice basePhyMinChoice = new ComBasePhyMinChoice(phyMins, _ob); if (basePhyMinChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK) { actRow.SetValue("EXCLUDE_PHY_MIN", basePhyMinChoice.ChoicePhyMinCodes); actRow.SetValue("EXCLUDE_PHY_MIN_NAME", basePhyMinChoice.ChoicePhyMinNames); } } } } }