using DevExpress.Data.ExpressionEditor; using DevExpress.XtraEditors; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.DevApp.UserControl { public partial class UcDictionaryComBox : DevExpress.XtraEditors.XtraUserControl { /// /// 下拉改变事件 /// public event EventHandler ChangedEvent; public UcDictionaryComBox() { InitializeComponent(); this.Load += (ss, ee) => { this.txt_qt003.SelectedIndexChanged += Txt_qt003_SelectedIndexChanged; }; } private void Txt_qt003_SelectedIndexChanged(object sender, EventArgs e) { if (ChangedEvent != null) ChangedEvent(this, e); } /// /// 文本框文字 /// public string TextTxt { get { return txt_qt003.Text.Trim(); } set { this.txt_qt003.Text = value; } } /// /// 文本框的次序 2025-12-12 加上 /// public int SelectedIndex { get { return txt_qt003.SelectedIndex; } set { this.txt_qt003.SelectedIndex = value; } } /// /// 查询条件 /// /// string _WhereTxt; public string WhereTxt { get { return _WhereTxt; } set { this._WhereTxt = value; if (!string.IsNullOrEmpty(value)) { getSuppler(value); } } } public bool IsReadly { set { this.txt_qt003.ReadOnly = value; this.txt_qt003.Enabled = !value; } } /// /// 读取仓库 /// /// /// public void getSuppler(string strWhere) { txt_qt003.Properties.Items.Clear(); string _where = " and 1=1 and " + strWhere; var pgq = new PageQueryModel(1, 999999, "a.defect_code", "asc", "", _where); var json = JsonConvert.SerializeObject(pgq); try { var strReturn = UtilityHelper.HttpPost("", "MesDefectCodeManager/GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); var dt = dd.rtnData.list; foreach (DataRow row in dt.Rows) { txt_qt003.Properties.Items.Add(row["defectName"].ToString()); } txt_qt003.SelectedIndex = 0; } catch (Exception ex) { MsgHelper.Warning("提示:" + ex.Message); } } } }