private void tsbSearch_Click(object sender, EventArgs e) { #region variable define string locationName = ""; //location name string locationLevel = ""; LocationEntity locationEntity = new LocationEntity(); //Location entity DataSet _returnDs = new DataSet(); #endregion #region search deal //get locationName 将当前txtName的值赋值给locationName locationName = this.txtName.Text.Trim().ToString(); //cmbLocationLevel下拉列表值不为空 locationName if (this.cbTypeEdit.Text != "") { //将cmbLocationLevel中选择的值取第一个字符赋值给变量locationLevel locationLevel = this.cbTypeEdit.Text.Substring(0, 1); } //set value to entity of LotNumber 判断locationName不为空 if (locationName != "") { locationEntity.LocationName = locationName; } locationEntity.LocalLevel = locationLevel; //call search action and get dataset _returnDs = locationEntity.SearchLocation(); if (locationEntity.ErrorMsg != "") { //show message “查询数据出错!” MessageBox.Show(StringParser.Parse("${res:FanHai.Hemera.Addins.EMS.LocationSearchDialog.MsgQueryDataFailure}")); } else { //gridView1中的数据用返回数据集的FMM_LOCATION表填充 this.gridView1.GridControl.DataSource = _returnDs.Tables[FMM_LOCATION_FIELDS.DATABASE_TABLE_NAME]; } #endregion }
/// <summary> /// 将调用远程对象查出的结果赋值给下拉框 /// </summary> private void BindDataToLoopUpEdit() { DataSet dsLocation = new DataSet(); LocationEntity location = new LocationEntity(); //根据区域名称和区域类型查询区域信息 location.LocalLevel = "5";//只查询车间数据 dsLocation = location.SearchLocation(); if (location.ErrorMsg != "") { //提示“获取区域出错!” MessageService.ShowError("${res:FanHai.Hemera.Addins.FMM.StoreCtrl.Msg.GetLocationError}"); } else { //若结果集中包含“FMM_LOCATION”表 if (dsLocation.Tables.Contains(FMM_LOCATION_FIELDS.DATABASE_TABLE_NAME)) { //为界面上的“区域”下拉框赋值 this.lueLocation.Properties.DataSource = dsLocation.Tables[FMM_LOCATION_FIELDS.DATABASE_TABLE_NAME]; this.lueLocation.Properties.DisplayMember = FMM_LOCATION_FIELDS.FIELD_LOCATION_NAME; this.lueLocation.Properties.ValueMember = FMM_LOCATION_FIELDS.FIELD_LOCATION_KEY; } } string[] columns = new string[] { "CODE", "NAME" }; KeyValuePair <string, string> category = new KeyValuePair <string, string>("CATEGORY_NAME", "Store_Type"); //得到线边仓类型的基础数据 DataTable dataTable = BaseData.Get(columns, category); //为界面上的“类型”下拉框赋值 this.lueType.Properties.DataSource = dataTable; this.lueType.Properties.DisplayMember = "NAME"; this.lueType.Properties.ValueMember = "CODE"; //????? this.lueStoreType.DataSource = dataTable; this.lueStoreType.DisplayMember = "NAME"; this.lueStoreType.ValueMember = "CODE"; try { IServerObjFactory factor = CallRemotingService.GetRemoteObject(); //调用远程对象的方法,得到最新版本的工序 DataSet dsReturn = factor.CreateIOperationEngine().GetMaxVerOperation(null); string msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); if (msg == string.Empty) { if (dsReturn != null && dsReturn.Tables.Count > 0 && dsReturn.Tables.Contains(POR_ROUTE_OPERATION_VER_FIELDS.DATABASE_TABLE_NAME)) { DataTable operationTable = dsReturn.Tables[POR_ROUTE_OPERATION_VER_FIELDS.DATABASE_TABLE_NAME]; foreach (DataRow dataRow in operationTable.Rows) { //设置界面上的“工序”内容为POR_ROUTE_OPERATION_VER表的工序名称 cmbOperation.Properties.Items.Add(dataRow[POR_ROUTE_OPERATION_VER_FIELDS.FIELD_ROUTE_OPERATION_NAME].ToString()); } } } else { throw new Exception(msg); } } catch (Exception ex) { MessageService.ShowError(ex.Message); } finally { CallRemotingService.UnregisterChannel(); } }