using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Data; using System.Drawing; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm { public partial class FrmJGAndMSC : FrmBase { public FrmJGAndMSC() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmJGAndMSC_Load(object sender, EventArgs e) { InitMSC(); GridHelper.RefreshAndAutoSize(ultraGrid1); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.InitMSC(); break; case "Delete": this.doDelete(true); break; case "Resume": this.doDelete(false); break; case "Close": this.Close(); break; } } private void InitMSC() { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGAndMSC.GetMSC", null, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true); if (dt != null && dt.Rows.Count > 0) { ultraGrid1.Rows[0].Activate(); } } public void doQuery() { UltraGridRow ugr = this.ultraGrid1.ActiveRow; string msc = ugr.Cells["MSC"].Value.ToString(); bool flag = this.ultraCheckEditor1.Checked; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGAndMSC.doQuery", new Object[] { flag, msc }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable2, true); UltraGridColumn[] col = new UltraGridColumn[] { this.ultraGrid2.DisplayLayout.Bands[0].Columns["MEMO"] }; GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid2, col); Infragistics.Win.UltraWinGrid.UltraGridRow row = null; for (int i = 0; i < ultraGrid2.Rows.Count; i++) { row = ultraGrid2.Rows[i]; if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效")) { row.Appearance.ForeColor = Color.Red; } else { row.Appearance.ForeColor = Color.Black; } } } /// /// 删除或恢复 /// /// TRUE删除 FALSE恢复 private void doDelete(bool flag) { UltraGridRow ugr = this.ultraGrid2.ActiveRow; if (ugr == null) { MessageBox.Show("请选择需要操作的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效" && flag == true) { MessageBox.Show("您选择的数据已经无效,无法作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (ugr.Cells["VALIDFLAG"].Value.ToString() == "有效" && flag == false) { MessageBox.Show("您选择的数据有效,无法恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBox.Show("是否确认" + (flag ? "作废" : "恢复") + "选中的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } string msc = ugr.Cells["MSC"].Value.ToString(); string code = ugr.Cells["CODE_JG"].Value.ToString(); string deletename = this.UserInfo.GetUserName(); int count = ServerHelper.SetData("com.steering.pss.qcm.JGAndMSC.doDeleteOrResume", new Object[] { flag, msc, code, deletename }, this.ob); if (count > 0) { doQuery(); if (flag == false) { Infragistics.Win.UltraWinGrid.UltraGridRow row = null; for (int i = 0; i < ultraGrid2.Rows.Count; i++) { row = ultraGrid2.Rows[i]; if (row.Cells["MSC"].Value.ToString().Equals(msc) && row.Cells["CODE_JG"].Value.ToString().Equals(code)) { row.Activate(); break; } } } } } private void ultraButton1_Click(object sender, EventArgs e) //JG选择 { UltraGridRow ugr1 = this.ultraGrid1.ActiveRow; string msc = ugr1.Cells["MSC"].Value.ToString(); string msc_desc = ugr1.Cells["MSC_DESC"].Value.ToString(); JGCodeManage jgcm = new JGCodeManage(ob, msc, msc_desc, "", "", "", "", "", "", "", "", "", "", ""); jgcm.ShowDialog(); this.ultraGrid1.ActiveRow = ugr1; doQuery(); } private void ultraButton2_Click(object sender, EventArgs e) //BL选择 { UltraGridRow ugr1 = this.ultraGrid1.ActiveRow; string msc = ugr1.Cells["MSC"].Value.ToString(); string msc_desc = ugr1.Cells["MSC_DESC"].Value.ToString(); BLCodeManageParms blCodeParms = new BLCodeManageParms(); blCodeParms.Ob = ob; blCodeParms.Msc = msc; blCodeParms.Msc_desc = msc_desc; BLCodeManage blcm = new BLCodeManage(blCodeParms); blcm.ShowDialog(); this.ultraGrid1.ActiveRow = ugr1; doQuery(); } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { doQuery(); } } }