3 Commits

4 changed files with 130 additions and 0 deletions
@@ -0,0 +1,96 @@
# 173/174 Popup Contains Filtering Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Make the DevExpress auto-filter row in 173/174 extended-return result popups use contains matching instead of starts-with matching.
**Architecture:** Keep the shared popup and query flow unchanged. Set `GridColumn.OptionsFilter.AutoFilterCondition` when each host dynamically creates result columns, following the existing `AutoFilterCondition.Contains` pattern already used elsewhere in Lskj.Control.
**Tech Stack:** C# on .NET Framework 4.0, WinForms, DevExpress GridControl/GridView.
## Global Constraints
- Work in `E:\lserp_project\lserp_cs_6.0` on `main` and preserve unrelated work.
- Do not change database search SQL, search-column selection, ResultFields mapping, clear, selection, or display translation behavior.
- Apply the behavior to both MyControl and GridControlEx 173/174 popup result columns.
- Do not add dependencies or require a framework newer than .NET Framework 4.0.
- Do not push unless the user explicitly requests it.
---
### Task 1: Set dynamic popup result columns to contains filtering
**Files:**
- Modify: `插件库/Lskj.Control/AutoGridLookUp/LabelExtendedReturnSearchEdit.cs`
- Modify: `插件库/Lskj.Control/GridControlEx.ExtendedReturn.cs`
**Interfaces:**
- Consumes: DevExpress `GridColumn.OptionsFilter.AutoFilterCondition` and `DevExpress.XtraGrid.Columns.AutoFilterCondition.Contains`.
- Produces: Contains-based local auto-filter behavior for every visible and hidden dynamic result column in both popup hosts.
- [ ] **Step 1: Run the failing structural contract**
Run from the repository root:
```powershell
$formPath = '插件库\Lskj.Control\AutoGridLookUp\LabelExtendedReturnSearchEdit.cs'
$gridPath = '插件库\Lskj.Control\GridControlEx.ExtendedReturn.cs'
$form = Get-Content -LiteralPath $formPath -Raw
$grid = Get-Content -LiteralPath $gridPath -Raw
$setting = 'column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;'
if (-not $form.Contains($setting)) { throw 'MyControl result columns do not use contains filtering.' }
if (-not $grid.Contains($setting)) { throw 'GridControlEx result columns do not use contains filtering.' }
```
Expected: fail on the MyControl assertion because neither dynamic result-column loop currently sets the condition.
- [ ] **Step 2: Implement the minimal per-column setting**
In `LabelExtendedReturnSearchEdit.ConfigureResultColumns`, immediately after assigning `column.Visible`, add:
```csharp
column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
```
In `GridControlEx.ConfigureExtendedReturnViewColumns`, immediately after assigning `column.Visible`, add the identical line:
```csharp
column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
```
Both files already import `DevExpress.XtraGrid.Columns`, so no new using directive is needed.
- [ ] **Step 3: Re-run the structural contract**
Run the exact PowerShell contract from Step 1.
Expected: exit code `0` with no exception.
- [ ] **Step 4: Compile the dependency chain in isolation**
Upload `/Users/langsukeji/Documents/MyApps/lserp_project/codex_compile_project.ps1` to `E:\lserp_project\codex_compile_project.ps1`. Create `E:\lserp_project\lserp_cs_6.0\DebugCodexFilterContains`, copy `Debug\*.dll` into it, then invoke the helper for these projects in order, using the temporary directory as both `DebugDirectory` and the output DLL directory:
1. `插件库\Lskj.Model\Lskj.Model.csproj`
2. `插件库\Lskj.Util\Lskj.Util.csproj`
3. `插件库\Lskj.Business\Lskj.Business.csproj`
4. `插件库\Lskj.Control\Lskj.Control.csproj`
Expected: all compiler exits are `0`; the existing `CS2023 /noconfig` warning is acceptable.
Delete the uploaded helper and `DebugCodexFilterContains` after compilation.
- [ ] **Step 5: Inspect and commit only the two source files**
```bat
git diff --check
git add -- "插件库/Lskj.Control/AutoGridLookUp/LabelExtendedReturnSearchEdit.cs" "插件库/Lskj.Control/GridControlEx.ExtendedReturn.cs"
git diff --cached --check
git commit -m "fix(control): use contains filtering in extended lookup"
git status --short
```
Expected: commit succeeds and the working tree is clean.
- [ ] **Step 6: Hand off runtime verification**
Ask the user to verify both MyControl and GridControlEx 173/174 popups by entering a middle substring such as `板` into the auto-filter row for a value such as `钢板/Q235B`. Do not push automatically.
@@ -0,0 +1,32 @@
# 173/174 弹窗本地筛选改为包含匹配
## 目标
将 173/174 扩展返回弹窗中 DevExpress 自动筛选行的文本匹配方式,从默认的“开头匹配”改为“包含匹配”。例如在“物料名称”筛选框输入“板”,应匹配“钢板/Q235B”。
## 根因
共享弹窗已经启用 `ShowAutoFilterRow`,但 MyControl 与 GridControlEx 在查询完成后动态创建结果列时,没有设置 `GridColumn.OptionsFilter.AutoFilterCondition`,因此沿用了 DevExpress 默认的开头匹配。
项目内其他表格列已普遍使用 `AutoFilterCondition.Contains`,可直接沿用这一兼容写法。
## 设计
仅修改两处动态结果列创建逻辑:
- `LabelExtendedReturnSearchEdit.ConfigureResultColumns`
- `GridControlEx.ConfigureExtendedReturnViewColumns`
每个结果列创建后设置:
```csharp
column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
```
不修改共享弹窗事件,不增加自定义筛选处理,不改变数据库查询 SQL、搜索列下拉框、ResultFields 映射、清空、选择和显示翻译逻辑。
## 验证
- 结构检查确认两处动态列均设置 `Contains`
- 编译 `Lskj.Model``Lskj.Util``Lskj.Business``Lskj.Control`
- 运行时由用户确认:自动筛选行输入位于文本中间的内容时仍能命中结果。
@@ -823,6 +823,7 @@ namespace Lskj.Control
column.Name = column.FieldName = dataColumn.ColumnName;
column.Caption = GetColumnCaption(dataColumn.ColumnName, mappings);
column.Visible = !dataColumn.ColumnName.StartsWith("_", StringComparison.Ordinal);
column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
popup.ResultView.Columns.Add(column);
}
@@ -1015,6 +1015,7 @@ namespace Lskj.Control
column.Name = column.FieldName = dataColumn.ColumnName;
column.Caption = GetExtendedReturnColumnCaption(dataColumn.ColumnName, mappings);
column.Visible = !dataColumn.ColumnName.StartsWith("_", StringComparison.Ordinal);
column.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
resultView.Columns.Add(column);
}