feat: add azxs preprocessing support for component category
All checks were successful
NTFY Notification / notify (push) Successful in 13s

Extend M05_PreProcessor to support category-specific preprocessing:
- "接头" category: Full preprocessing (azxs + lcfw mapping, OR merging, parentheses simplification)
- "部件" category: Partial preprocessing (azxs mapping only, OR merging, parentheses simplification)
- Other categories: No preprocessing

Add new function ApplyPreprocessingWithoutLcfw() to handle component category preprocessing.

Add unit tests (PP_09 through PP_12) to verify:
- azxs mapping for component category
- lcfw conditions remain unchanged for component category
- OR condition merging and parentheses simplification

Update CLAUDE.md documentation with category-specific preprocessing table.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-11 09:49:38 +08:00
parent 90a62231e0
commit ec579b30b2
3 changed files with 134 additions and 17 deletions

View File

@@ -46,6 +46,10 @@ Public Sub RunAllTests()
Test_PP_06_FullIntegration
Test_PP_07_NonJointCategory
Test_PP_08_UnmappedValues
Test_PP_09_ComponentCategory_AzxsMapping
Test_PP_10_ComponentCategory_LcfwUnchanged
Test_PP_11_ComponentCategory_ORMerging
Test_PP_12_ComponentCategory_ParenthesesSimplification
' 汇总结果
Debug.Print String(50, "-")
@@ -369,8 +373,8 @@ Private Sub Test_PP_06_FullIntegration()
End Sub
' ------------------------------------------------------------------------------
' 测试用例 PP_07: 测试非"接头"类别
' 验证其他类别不受预处理影响
' 测试用例 PP_07: 测试非"接头"/"部件"类别
' 验证其他类别(如"弹性元件"不受预处理影响
' ------------------------------------------------------------------------------
Private Sub Test_PP_07_NonJointCategory()
SetupPreProcessorTest
@@ -378,9 +382,9 @@ Private Sub Test_PP_07_NonJointCategory()
Dim inputCond As String
inputCond = "gclj=M20 AND lcfw=M01"
' 使用"件"类别
' 使用"弹性元件"类别
Dim result As String
result = M05_PreProcessor.PreprocessCondition(inputCond, "件", 1)
result = M05_PreProcessor.PreprocessCondition(inputCond, "弹性元件", 1)
' 应该保持不变
Assert_Equal result, inputCond, "PP07_NonJoint_Unchanged"
@@ -407,6 +411,67 @@ Private Sub Test_PP_08_UnmappedValues()
' 注意:这个测试可能需要根据实际日志记录行为调整
End Sub
' ------------------------------------------------------------------------------
' 测试用例 PP_09: 测试"部件"类别的azxs映射
' ------------------------------------------------------------------------------
Private Sub Test_PP_09_ComponentCategory_AzxsMapping()
SetupPreProcessorTest
Dim result1 As String
result1 = M05_PreProcessor.PreprocessCondition("azxs=A0 AND gclj=M20", "部件", 1)
Assert_Equal result1, "azxs=径向 AND gclj=M20", "PP09_Component_Azxs_Mapping"
Dim result2 As String
result2 = M05_PreProcessor.PreprocessCondition("gclj=M20 AND azxs=B0", "部件", 2)
Assert_Equal result2, "gclj=M20 AND azxs=下轴向", "PP09_Component_Azxs_With_AND"
End Sub
' ------------------------------------------------------------------------------
' 测试用例 PP_10: 测试"部件"类别的lcfw条件保持不变
' ------------------------------------------------------------------------------
Private Sub Test_PP_10_ComponentCategory_LcfwUnchanged()
SetupPreProcessorTest
Dim result1 As String
result1 = M05_PreProcessor.PreprocessCondition("lcfw=M01 AND gclj=M20", "部件", 1)
Assert_Equal result1, "lcfw=M01 AND gclj=M20", "PP10_Component_Lcfw_Unchanged"
Dim result2 As String
result2 = M05_PreProcessor.PreprocessCondition("gclj=M20 AND lcfw=M01", "部件", 2)
Assert_Equal result2, "gclj=M20 AND lcfw=M01", "PP10_Component_Lcfw_Unchanged_Reverse"
End Sub
' ------------------------------------------------------------------------------
' 测试用例 PP_11: 测试"部件"类别的OR条件合并
' ------------------------------------------------------------------------------
Private Sub Test_PP_11_ComponentCategory_ORMerging()
SetupPreProcessorTest
Dim result1 As String
result1 = M05_PreProcessor.PreprocessCondition("(azxs=A0 OR azxs=AT) AND gclj=M20", "部件", 1)
Assert_Equal result1, "azxs=径向 AND gclj=M20", "PP11_Component_OR_Merging_Azxs"
' 测试精确重复的OR条件合并
Dim result2 As String
result2 = M05_PreProcessor.PreprocessCondition("azxs=径向 OR azxs=径向", "部件", 2)
Assert_Equal result2, "azxs=径向", "PP11_Component_Exact_Duplicate_Merging"
End Sub
' ------------------------------------------------------------------------------
' 测试用例 PP_12: 测试"部件"类别的括号简化
' ------------------------------------------------------------------------------
Private Sub Test_PP_12_ComponentCategory_ParenthesesSimplification()
SetupPreProcessorTest
Dim result1 As String
result1 = M05_PreProcessor.PreprocessCondition("(azxs=A0 OR azxs=AT) AND gclj=M20", "部件", 1)
Assert_Equal result1, "azxs=径向 AND gclj=M20", "PP12_Component_Parentheses_Simplified"
Dim result2 As String
result2 = M05_PreProcessor.PreprocessCondition("gclj=M20 AND (azxs=A0 OR azxs=AT)", "部件", 2)
Assert_Equal result2, "gclj=M20 AND azxs=径向", "PP12_Component_Parentheses_Simplified_Reverse"
End Sub
' ------------------------------------------------------------------------------
' 辅助函数:设置预处理测试环境
' ------------------------------------------------------------------------------