using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using ICSSoft.Frame.User.BLL; using ICSSoft.Base.Config.AppConfig; using ICSSoft.Base.Language.Tool; using ICSSoft.Base.UserControl.MessageControl; using ICSSoft.Base.Config.DBHelper; using ICSSoft.Base.ReferForm.AppReferForm; using ICSSoft.Frame.Data.Entity; using ICSSoft.Frame.Data.BLL; namespace ICSSoft.Frame.APP { public partial class FormICSONWIPCheckNCRSelect : DevExpress.XtraEditors.XtraForm { DataRow[] drs = null; public Action action { get; set; } bool IsBatch = false; public FormICSONWIPCheckNCRSelect(DataRow[] drs) { InitializeComponent(); IsBatch = Convert.ToBoolean(drs[0]["IsBatch"]); string CheckMode = drs[0]["CheckMode"].ToString(); bool ISWWRW = Convert.ToBoolean(drs[0]["ISWWRW"]); string LOTNO = drs[0]["LOTNO"].ToString(); string OPCODE = drs[0]["OPCODE"].ToString(); string OPDESC = drs[0]["OPDESC"].ToString(); int OPSEQ = Convert.ToInt32(drs[0]["OPSEQ"]); chkIsBatch.Properties.ReadOnly = true; chkIsBatch.Checked = IsBatch; this.drs = drs; //grdDetail.DataSource = this.dataSource; if (IsBatch) { this.listBox.Visible = true; this.Height = 263; } else { this.listBox.Visible = false; this.Height = 133; } //结果选项列表(1.非过程2.批量判,且不是委外返工退镀,容许退货) DataTable dt1 = ICSSys_EnumValuesBLL.GetNcrResultItems(IsBatch && !(OPDESC.Contains("退镀") && ISWWRW), AppConfig.WorkPointCode); txtResult.Properties.ValueMember = "结果判定"; txtResult.Properties.DisplayMember = "结果判定"; txtResult.Properties.DataSource = dt1; txtResult.Properties.NullText = ""; txtResult.Properties.ImmediatePopup = true; txtResult.Properties.ValidateOnEnterKey = true; txtResult.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; txtResult.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; txtResult.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; //获取责任工序选项列表 DataTable dt = ICSResOPBLL.GetResOPList(LOTNO, OPSEQ, AppConfig.WorkPointCode); lookupErrOP.Properties.ValueMember = "OP"; lookupErrOP.Properties.DisplayMember = "OP"; lookupErrOP.Properties.DataSource = dt; lookupErrOP.Properties.NullText = "";//空时的值 lookupErrOP.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体 lookupErrOP.Properties.ValidateOnEnterKey = true;//回车确认 lookupErrOP.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard lookupErrOP.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容 lookupErrOP.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; listBox.Items.Clear(); if (IsBatch) { List list = new List(); foreach (DataRow dr in drs) { if (!Convert.ToBoolean(dr["isSelect"])) { list.Add("不良类型:" + dr["UNIT"].ToString() + "数量:" + dr["SetValue"].ToString() + "不良备注:" + dr["不良备注"].ToString()); } } if (list.Count > 0) { listBox.Items.Add("当前是批量处理,以下不良未选取:"); listBox.Items.AddRange(list.ToArray()); } } } private void btnClose_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } private void btnOK_Click(object sender, EventArgs e) { if (txtResult.Text == "") { ICSBaseSimpleCode.AppshowMessageBox("请选择责任判定结果"); return; } if (lookupErrOP.Text == "") { ICSBaseSimpleCode.AppshowMessageBox("请选择责任工序"); return; } try { if (listBox.Items.Count > 0) { if (MessageBox.Show("未勾选全部不良,是否全部勾选?", "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } foreach (DataRow dr in drs) { dr["isSelect"] = true; } } action(txtResult.Text, lookupErrOP.Text); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { ICSBaseSimpleCode.AppshowMessageBox(ex.Message); } } private void btnCanncel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } } }