lu
2025-01-21 dd7c9629d16d81bde03e42b3e9e984088f3e4d2c
DevApp/Gs.DevApp/UserControl/UcLookCk.cs
@@ -15,19 +15,10 @@
            lookSearchSupplier.Properties.NullText = "请选择";
            lookSearchSupplier.EditValueChanged +=
                LookSearchSupplier_EditValueChanged;
        }
        private string _KeyFile = "";
        public string KeyFile
        {
            get { return _KeyFile; }
            set
            {
                _KeyFile = value;
                getSuppler();
            }
        }
        public bool IsReadly { get; set; }
        /// <summary>
        ///     改变事件
        /// </summary>
@@ -39,10 +30,13 @@
            if (EditChanged != null) EditChanged(this, e);
        }
        private void getSuppler()
        public void getSuppler(string orgId)
        {
            var pgq = new PageQueryModel(1, 999999, "depot_code", "asc", "",
                " and is_ng='A'");
            string _keyWhere = "";
            if (!string.IsNullOrEmpty(orgId))
                _keyWhere = " and a.FSubsidiary ='" + orgId + "'";
            var pgq = new PageQueryModel(1, 999999, "org.FNumber asc ,a.depot_code", "asc", "",
                " and is_ng='A'"+_keyWhere);
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
@@ -52,8 +46,9 @@
                var dt = rtn.rtnData.list;
                lookSearchSupplier.Properties.DataSource = dt;
                lookSearchSupplier.Properties.DisplayMember = "depotName";
                // lookSearchSupplier.Properties.ValueMember = "depotId";
                lookSearchSupplier.Properties.ValueMember = KeyFile;
                lookSearchSupplier.Properties.ValueMember = "depotId";
                lookSearchSupplier.ForceInitialize();
                lookSearchSupplier.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
            }
            catch (Exception ex)
            {
@@ -94,10 +89,38 @@
                lookSearchSupplier.EditValue = null;
                return;
            }
            if (KeyFile.ToUpper() == "depotId".ToUpper())
                lookSearchSupplier.EditValue =Int64.Parse( ((Code.ToString().Trim())));
            else
                lookSearchSupplier.EditValue = ((Code.ToString().Trim()));
            if(!string.IsNullOrEmpty(Code))
            lookSearchSupplier.EditValue = Int64.Parse(((Code.ToString().Trim())));
        }
        /// <summary>
        /// 读取组织ID
        /// </summary>
        /// <returns></returns>
        public string GetOrgId()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["OrgId"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 读取组织名称
        /// </summary>
        /// <returns></returns>
        public string GetOrgName()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["OrgName"].ToString();
                return id;
            }
            return "";
        }
    }
}