1
lu
2024-11-13 13e0b579eb4ad6151e2f27b822837be81d3f6143
DevApp/Gs.DevApp/UserControl/UcLookItems.cs
@@ -19,11 +19,12 @@
        public UcLookItems()
        {
            InitializeComponent();
            lookSearchSupplier.Properties.NullText = "请选择";
            lookSearchSupplier.EditValueChanged +=
                LookSearchSupplier_EditValueChanged;
        }
        public bool IsReadly { get; set; }
        private string _KeyFile = "";
        public string KeyFile
        {
@@ -31,7 +32,8 @@
            set
            {
                _KeyFile = value;
                getSuppler();
                if (!string.IsNullOrEmpty(_KeyFile))
                    getSuppler();
            }
        }
        /// <summary>
@@ -45,17 +47,18 @@
            if (EditChanged != null) EditChanged(this, e);
        }
        private void getSuppler()
        private async void getSuppler()
        {
            UcLoading _loading = new UcLoading();
            var pgq = new PageQueryModel(1, 999999, "item_name", "asc", "",
                " and fforbidstatus='A'");
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
                var strReturn = UtilityHelper.HttpPost("",
                    "MesItemsManager/GetListPage", json);
                var rtn = UtilityHelper.ReturnToTablePage(strReturn);
                var dt = rtn.rtnData.list;
                var strReturn = await UtilityHelper.HttpPostAsync("",
                    "MesItemsManager/GetListPageByLook", json);
                var rtn = UtilityHelper.ReturnToList(strReturn);
                var dt = rtn.rtnData;
                lookSearchSupplier.Properties.DataSource = dt;
                lookSearchSupplier.Properties.DisplayMember = "itemName";
                // lookSearchSupplier.Properties.ValueMember = "depotId";
@@ -65,6 +68,7 @@
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
            _loading.Close();
        }
        public string GetId()
@@ -92,11 +96,27 @@
            var name = lookSearchSupplier.Text.Trim();
            return name;
        }
        public string GetModel()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null) {
                string id = row["itemModel"].ToString();
                return id;
            }
            return "";
        }
        public void SetIdOrCode(string Code)
        {
            if (Code == "-1")
            {
                lookSearchSupplier.EditValue = null;
                return;
            }
            if (KeyFile == "id")
                lookSearchSupplier.EditValue = Int64.Parse((Code.ToString().Trim()));
            {
                lookSearchSupplier.EditValue =((Code.ToString().Trim()));
            }
            else
                lookSearchSupplier.EditValue = ((Code.ToString().Trim()));
        }