| | |
| | | txt.IsReadly = isEdt; |
| | | continue; |
| | | } |
| | | //自定义库位 |
| | | if (colType is UcLookKw) |
| | | { |
| | | var txt = colType as UcLookKw; |
| | | txt.SetIdOrCode(strVal); |
| | | txt.IsReadly = isEdt; |
| | | continue; |
| | | } |
| | | //自定义供应商 |
| | | if (colType is UcLookSupplier) |
| | | { |
| | |
| | | txt.IsReadly = isEdt; |
| | | continue; |
| | | } |
| | | //自定义库位 |
| | | if (ctrl is UcLookKw) |
| | | { |
| | | var txt = ctrl as UcLookKw; |
| | | txt.SetIdOrCode("-1"); |
| | | txt.IsReadly = isEdt; |
| | | continue; |
| | | } |
| | | //自定义供应商 |
| | | if (ctrl is UcLookSupplier) |
| | | { |
| | |
| | | if (ctrl is UcLookCk) |
| | | { |
| | | var txt = ctrl as UcLookCk; |
| | | txt.IsReadly = isEdt; |
| | | continue; |
| | | } |
| | | //自定义库位 |
| | | if (ctrl is UcLookKw) |
| | | { |
| | | var txt = ctrl as UcLookKw; |
| | | txt.IsReadly = isEdt; |
| | | continue; |
| | | } |
| | |
| | | } |
| | | public delegate void DelegateGetModel(string guid); |
| | | public delegate void DelegateGetList(int currentPage); |
| | | public delegate void DelegateGetUserControlList(); |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | action2(_guid); |
| | | }; |
| | | } |
| | | gridView1.RowCellStyle += (s, e) => |
| | | { |
| | | GridView view = s as GridView; |
| | | if (view != null && e.Column != null && e.CellValue != null) |
| | | { |
| | | if (e.Column.FieldName.EndsWith("Color")) |
| | | { |
| | | int rowHandle = e.RowHandle; |
| | | if (rowHandle >= 0) |
| | | { |
| | | DataRow row = gridView1.GetDataRow(e.RowHandle); |
| | | string _bgColor = row[e.Column.FieldName + "Rgb"].ToString(); |
| | | if (!string.IsNullOrEmpty(_bgColor)) |
| | | { |
| | | Color bgColor = ColorTranslator.FromHtml(_bgColor); |
| | | e.Appearance.BackColor = bgColor; |
| | | //e.Appearance.BackColor2 = Color.LightSkyBlue; |
| | | //e.Appearance.ForeColor = ColorTranslator.FromHtml("#ffffff") ; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | gridView1.RowStyle += (s, e) => |
| | | { |
| | | //默认选中行不变色 |
| | |
| | | column.Width = maxWidth; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 设置选项卡 |
| | | /// </summary> |
| | |
| | | /// <param name="pageBar1"></param> |
| | | /// <param name="action"></param> |
| | | /// <param name="page"></param> |
| | | public static void SetTabParameter(GridView gridView1, DevExpress.XtraTab.XtraTabControl xtraTabControl1, UcPageBar pageBar1, DelegateGetModel action = null, DelegateGetList page = null, Label lbGuid = null) |
| | | public static void SetTabParameter(GridView gridView1, DevExpress.XtraTab.XtraTabControl xtraTabControl1, UcPageBar pageBar1, DelegateGetModel action = null, DelegateGetList page = null, Label lbGuid = null, UcToolBarMenu barMenu = null, DelegateGetUserControlList ucLst = null) |
| | | { |
| | | xtraTabControl1.SelectedPageChanged += (s, e) => |
| | | { |
| | | if (pageBar1 != null && xtraTabControl1.SelectedTabPageIndex == 0) |
| | | { |
| | | if (barMenu != null) |
| | | barMenu.SetAllButton(0); |
| | | |
| | | page(pageBar1.CurrentPage); |
| | | int rowHandle = 0; |
| | | rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], lbGuid.Text); |
| | | if (rowHandle < 0) |
| | | rowHandle = 0; |
| | | gridView1.FocusedRowHandle = rowHandle; |
| | | return; |
| | | } |
| | | |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | | int _handle = gridView1.FocusedRowHandle; |
| | |
| | | return; |
| | | } |
| | | action(_guid); |
| | | return; |
| | | } |
| | | if (pageBar1 != null && xtraTabControl1.SelectedTabPageIndex == 0) |
| | | |
| | | if (barMenu != null && xtraTabControl1.SelectedTabPageIndex == 2) |
| | | { |
| | | page(pageBar1.CurrentPage); |
| | | int rowHandle = 0; |
| | | rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], lbGuid.Text); |
| | | if (rowHandle < 0) |
| | | rowHandle = 0; |
| | | gridView1.FocusedRowHandle = rowHandle; |
| | | barMenu.SetAllButton(2); |
| | | ucLst(); |
| | | return; |
| | | } |
| | | }; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | #region GridView汇总配置工具方法 |
| | | /// <summary> |
| | | /// 2025-08-14 kyy 快速配置GridView底部汇总(启用汇总行+设置列求和汇总) |
| | | /// </summary> |
| | | /// <param name="gridView">目标GridView控件</param> |
| | | /// <param name="summaryColumns">需要进行求和汇总的列名数组</param> |
| | | public static void SetupGridSummary(DevExpress.XtraGrid.Views.Grid.GridView gridView, params string[] summaryColumns) |
| | | { |
| | | // 启用底部汇总行 |
| | | gridView.OptionsView.ShowFooter = true; |
| | | |
| | | // 为每个指定列设置求和汇总 |
| | | foreach (var columnName in summaryColumns) |
| | | { |
| | | // 验证列是否存在(避免异常) |
| | | if (gridView.Columns[columnName] != null) |
| | | { |
| | | gridView.Columns[columnName].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; |
| | | gridView.Columns[columnName].SummaryItem.DisplayFormat = "合计: {0}"; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 数据过滤 |
| | | /// </summary> |