| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraEditors.Controls; |
| | | using DevExpress.XtraGrid.Columns; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using Gs.DevApp.DevFrm.Rk; |
| | | using Gs.DevApp.Entity; |
| | |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); |
| | | }, tips); |
| | | // 添加gridView1的RowStyle事件,当退货标识th=1时整行标红 |
| | | gridView1.RowStyle += GridView1_RowStyle; |
| | | // 添加gvMx1的RowStyle事件,当处理意见clyj为"退货"时整行标红 |
| | | gvMx1.RowStyle += GvMx1_RowStyle; |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => |
| | | { |
| | | getModel(value); |
| | |
| | | gvMx1.UpdateCurrentRow(); |
| | | gvMx1.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); |
| | | ConfigureOaColumns(); |
| | | // 刷新视图样式,使RowStyle事件生效 |
| | | gvMx1.RefreshData(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | }; |
| | | frm.ShowDialog(); |
| | | }; |
| | | |
| | | ConfigureOaColumns(); |
| | | } |
| | | |
| | | |
| | | private void ConfigureOaColumns() |
| | | { |
| | | ConfigureOaColumn(gridColumn15, "clyj", "处理意见", 17); |
| | | ConfigureOaColumn(gridColumn16, "txsl", "挑选数量", 18); |
| | | ConfigureOaColumn(gridColumn2, "xblb", "选别类别", 19); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// gridView1的RowStyle事件,当退货标识th=1时整行标红 |
| | | /// </summary> |
| | | private void GridView1_RowStyle(object sender, RowStyleEventArgs e) |
| | | { |
| | | if (e.RowHandle >= 0) |
| | | { |
| | | var view = sender as GridView; |
| | | if (view != null) |
| | | { |
| | | var thValue = view.GetRowCellValue(e.RowHandle, "th"); |
| | | if (thValue != null && thValue.ToString() == "1") |
| | | { |
| | | e.Appearance.BackColor = System.Drawing.Color.Red; |
| | | e.Appearance.ForeColor = System.Drawing.Color.White; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// gvMx1的RowStyle事件,当处理意见clyj为"退货"时整行标红 |
| | | /// </summary> |
| | | private void GvMx1_RowStyle(object sender, RowStyleEventArgs e) |
| | | { |
| | | if (e.RowHandle >= 0) |
| | | { |
| | | var view = sender as GridView; |
| | | if (view != null) |
| | | { |
| | | try |
| | | { |
| | | var clyjValue = view.GetRowCellValue(e.RowHandle, "clyj"); |
| | | if (clyjValue != null && !string.IsNullOrEmpty(clyjValue.ToString())) |
| | | { |
| | | string clyj = clyjValue.ToString().Trim(); |
| | | if (clyj == "退货") |
| | | { |
| | | e.Appearance.BackColor = System.Drawing.Color.Red; |
| | | e.Appearance.ForeColor = System.Drawing.Color.White; |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | // 如果列不存在,忽略错误 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static void ConfigureOaColumn(GridColumn column, string fieldName, string caption, int visibleIndex) |
| | | { |
| | | if (column == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(fieldName)) |
| | | { |
| | | column.FieldName = fieldName; |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(caption)) |
| | | { |
| | | column.Caption = caption; |
| | | } |
| | | |
| | | column.Visible = true; |
| | | column.VisibleIndex = visibleIndex; |
| | | column.OptionsColumn.AllowEdit = false; |
| | | column.OptionsColumn.ReadOnly = true; |
| | | column.OptionsColumn.ShowInCustomizationForm = true; |
| | | } |
| | | |
| | | |
| | | private void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |
| | | _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); |
| | |
| | | gridViews.Add(gvMx1); |
| | | UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | ConfigureOaColumns(); |
| | | //增加时,默认组织 |
| | | string deftOrg = UtilityHelper.GetFirstOrg(txt_receiveOrgId); |
| | | txt_isSrm.Checked = false; |
| | |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); |
| | | ConfigureOaColumns(); |
| | | // 刷新视图样式,使RowStyle事件生效 |
| | | gvMx1.RefreshData(); |
| | | } |
| | | else |
| | | { |
| | | UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | ConfigureOaColumns(); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |