feat: add preprocessing with value mapping to BOM Extraction System
All checks were successful
NTFY Notification / notify (push) Successful in 4s

Add a preprocessing step to the BOM Extraction System to enhance parameter
extraction with mapping values from "对照表" worksheet. For azxs (安装形式)
and lcfw (量程范围), the system now stores both the raw parsed value AND the
mapped value from the lookup table, enabling flexible dual-value matching.

Changes:
- Create M06A_Mapper.bas: New module for value mapping
  - Load azxs/lcfw mappings from "对照表" worksheet
  - Return dual-value format "raw,mapped" (e.g., "A0,径向")
  - Support graceful degradation if "对照表" not found
  - Define constants locally to avoid VBA cross-module reference issues

- Modify M06_ModelParser.bas:
  - Extract raw parameter values first
  - Apply mapping via M06A_Mapper if initialized
  - Store dual values for azxs and lcfw parameters

- Modify M07_BOMMatcher.bas:
  - Update EvaluateCellCondition() to support dual-value matching
  - Split by comma and check if ANY value matches
  - Backward compatible with single-value parameters

- Modify M09_BOMExtractor.bas:
  - Initialize M06A_Mapper during RunBOMExtraction()
  - Add WorksheetExists() helper function
  - Log warning if "对照表" worksheet not found
  - Define MAPPING_SHEET_NAME constant locally

- Modify M04_Config.bas:
  - Add mapping table configuration constants
  - MAPPING_SHEET_NAME, MAPPING_COL_LCFW_KEY, etc.

- Update CLAUDE.md:
  - Document new M06A_Mapper module
  - Update data flow diagram with mapping step
  - Document dual-value matching behavior
  - Update system architecture diagram

- Update docs/RunBOMExtraction_运行机制详解.md:
  - Add M06A_Mapper to all diagrams and documentation
  - Add detailed value mapping section
  - Update sequence diagrams with mapping flow
  - Update parameter examples with dual-value format
  - Bump documentation version to 3.0

Example:
  Input:  Product model "YTHN-100.A0.531.G123.M04.Y3"
  Parse:  azxs="A0", lcfw="M04"
  Map:    azxs="A0,径向", lcfw="M04,高压"
  Match:  BOM库 with azxs="径向" OR "A0" → MATCH

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-12 17:52:03 +08:00
parent 21f5f1c299
commit 1d5bad86f7
7 changed files with 626 additions and 47 deletions

View File

@@ -96,27 +96,63 @@ Public Function ParseProductModel(ByVal modelString As String) As Object
' 步骤5: 提取各参数
' 注意segments(0)是"型号-公称外径"需要从segments(1)开始提取参数
' 提取原始值
Dim azxsRaw As String, bkxsRaw As String
Dim gcljRaw As String, jyczRaw As String
Dim lcfwRaw As String, fjgnRaw As String
If UBound(segments) - LBound(segments) + 1 >= 2 Then
params("azxs") = ExtractAzxs(segments(1))
azxsRaw = ExtractAzxs(segments(1))
End If
If UBound(segments) - LBound(segments) + 1 >= 3 Then
params("bkxs") = ExtractBkxs(segments(2))
bkxsRaw = ExtractBkxs(segments(2))
End If
If UBound(segments) - LBound(segments) + 1 >= 4 Then
Dim gclj As String, jycz As String
Call ExtractGcljAndJycz(segments(3), gclj, jycz)
params("gclj") = gclj
params("jycz") = jycz
Call ExtractGcljAndJycz(segments(3), gcljRaw, jyczRaw)
End If
If UBound(segments) - LBound(segments) + 1 >= 5 Then
params("lcfw") = ExtractLcfw(segments(4))
lcfwRaw = ExtractLcfw(segments(4))
End If
If UBound(segments) - LBound(segments) + 1 >= 6 Then
params("fjgn") = ExtractFjgn(segments, 5)
fjgnRaw = ExtractFjgn(segments, 5)
End If
' 步骤6: 应用映射(如果映射器已初始化)
If M06A_Mapper.IsInitialized() Then
' 应用azxs和lcfw映射返回双值格式raw,mapped
If Len(azxsRaw) > 0 Then
params("azxs") = M06A_Mapper.MapAzxs(azxsRaw)
End If
If Len(lcfwRaw) > 0 Then
params("lcfw") = M06A_Mapper.MapLcfw(lcfwRaw)
End If
Else
' 映射器未初始化,使用原始值
If Len(azxsRaw) > 0 Then
params("azxs") = azxsRaw
End If
If Len(lcfwRaw) > 0 Then
params("lcfw") = lcfwRaw
End If
End If
' 添加其他参数(不需要映射)
If Len(bkxsRaw) > 0 Then
params("bkxs") = bkxsRaw
End If
If Len(gcljRaw) > 0 Then
params("gclj") = gcljRaw
End If
If Len(jyczRaw) > 0 Then
params("jycz") = jyczRaw
End If
If Len(fjgnRaw) > 0 Then
params("fjgn") = fjgnRaw
End If
Set ParseProductModel = params