using System; using System.Data; using System.Text; using System.Windows.Forms; using 优软MES.DataOperate; using 优软MES.Properties; using 优软MES.PublicMethod; namespace 优软MES { public partial class Batch_Generation_Code : Form { string caller = "BarcodeIn!Deal"; string formname = "Batch_Generation_Code"; string defaultCondition = "pi_statuscode='UNPOST' and nvl(pr_tracekind,0)>0 "; string[] hiddenfield = { }; DataHelper dh = new DataHelper(); AutoSizeFormClass asc = new AutoSizeFormClass(); public Batch_Generation_Code() { InitializeComponent(); DataTable dt = dh.GetConfigureData(caller, "DataList", defaultCondition); //添加图片列 DataGridViewImageColumn ic = new DataGridViewImageColumn(); ic.Image = Resources.write_15_893687707641px_1181413_easyicon_net; ic.Width = 40; ic.Name = "操作"; ic.ToolTipText = "修改当前行数据"; BGC_DataGrid.DataSource = dt; BGC_DataGrid.Columns.Add(ic); //带有DbFind的需要传递Caller 和Form的名称 //BaseUtil.HideField(BGC_DataGrid,hiddenfield); pi_inoutno.Caller = caller; pi_inoutno.FormName = formname; pr_code.Caller = caller; pr_code.FormName = formname; wh_code.Caller = caller; wh_code.FormName = formname; } private void Screen_Button_Click(object sender, EventArgs e) { string beginTime = timePickerWithCombo1.BeginTime; string endTime = timePickerWithCombo1.EndTime; //因为是自定义控件,所以需要获取控件的子控件,然后再去获取值 string pi_inoutno = this.pi_inoutno.Text; string pr_code = this.pr_code.Text; string pd_location = wh_code.Text; string pi_status = this.pi_status.Text; StringBuilder condition = new StringBuilder(); if (!string.IsNullOrWhiteSpace(beginTime) && !string.IsNullOrWhiteSpace(endTime)) { condition.Append(" to_char(pi_date,'yyyy/MM/dd hh:mm:ss') between '" + beginTime + "' and '" + endTime + "'"); } if (!string.IsNullOrEmpty(pi_inoutno)) { if (condition.Length == 0) { condition.Append(" pi_inoutno like '%" + pi_inoutno + "%' "); } else { condition.Append(" and pi_inoutno like '%" + pi_inoutno + "%'"); } } if (!string.IsNullOrEmpty(pr_code)) { if (condition.Length == 0) { condition.Append(" pr_code like '%" + pr_code + "%'"); } else { condition.Append(" and pr_code like '%" + pr_code + "%'"); } } if (!string.IsNullOrEmpty(pd_location)) { if (condition.Length == 0) { condition.Append(" pd_whcode like '%" + pd_location + "%'"); } else { condition.Append(" and pd_whcode like '%" + pd_location + "%'"); } } if (condition.Length != 0) { BGC_DataGrid.DataSource = dh.GetConfigureData(caller, "DataList", condition.ToString()); } else { BGC_DataGrid.DataSource = dh.GetConfigureData(caller, "DataList", defaultCondition); } } private void BGC_DataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (BGC_DataGrid.Columns[e.ColumnIndex].Name == "操作") { Batch_Generation_CodeDetail BGCD = new Batch_Generation_CodeDetail(BGC_DataGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString()); BGCD.ShowDialog(); } } private void Batch_Generation_Code_Load(object sender, EventArgs e) { asc.controllInitializeSize(this); } private void Batch_Generation_Code_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); } private void Panel0_Paint(object sender, PaintEventArgs e) { } } }