feat: add additional features (fjgn) support
- Add fjgn (附加功能) field extraction from instrument characteristics - Extract additional features from model number's instrument feature field - Merge all fields from index 5 onwards to handle dot separators in features - Remove oil-fill type (Y+digit) suffix from additional features - Normalize separators (comma and dot) to comma for consistent parsing - Implement multi-value matching for fjgn conditions (contains logic) - fjgn=N1: true if fjgn contains N1 - fjgn!=N1: true if fjgn does not contain N1 - Add fjgn to condition config in MainModule and BIPUploadModule Fixes issue where additional features with dot separators (e.g., N3.N2.Y3) were incorrectly parsed by merging all fields from index 5 onwards. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -146,8 +146,16 @@ Private Function EvaluateSingleCondition(condition As String, Conditions As Obje
|
|||||||
EvaluateSingleCondition = True
|
EvaluateSingleCondition = True
|
||||||
Else
|
Else
|
||||||
actualValue = Conditions(varName)
|
actualValue = Conditions(varName)
|
||||||
|
|
||||||
|
' fjgn字段特殊处理(多值匹配)
|
||||||
|
If varName = "fjgn" Then
|
||||||
|
' fjgn!=N1:检查actualValue中是否不包含value
|
||||||
|
EvaluateSingleCondition = (InStr(actualValue, value) = 0)
|
||||||
|
Else
|
||||||
|
' 其他字段使用精确匹配
|
||||||
EvaluateSingleCondition = (actualValue <> value)
|
EvaluateSingleCondition = (actualValue <> value)
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
Exit Function
|
Exit Function
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -164,8 +172,16 @@ Private Function EvaluateSingleCondition(condition As String, Conditions As Obje
|
|||||||
EvaluateSingleCondition = False
|
EvaluateSingleCondition = False
|
||||||
Else
|
Else
|
||||||
actualValue = Conditions(varName)
|
actualValue = Conditions(varName)
|
||||||
|
|
||||||
|
' fjgn字段特殊处理(多值匹配)
|
||||||
|
If varName = "fjgn" Then
|
||||||
|
' fjgn=N1:检查actualValue中是否包含value
|
||||||
|
EvaluateSingleCondition = (InStr(actualValue, value) > 0)
|
||||||
|
Else
|
||||||
|
' 其他字段使用精确匹配
|
||||||
EvaluateSingleCondition = (actualValue = value)
|
EvaluateSingleCondition = (actualValue = value)
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
Exit Function
|
Exit Function
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -150,6 +150,31 @@ Private Function ParseHeader() As Boolean
|
|||||||
lcfw = Trim(dotParts(4))
|
lcfw = Trim(dotParts(4))
|
||||||
pConditions.Add "lcfw", lcfw
|
pConditions.Add "lcfw", lcfw
|
||||||
|
|
||||||
|
' 仪表特性 - 第6个位置(索引5)及之后的所有部分
|
||||||
|
' 因为仪表特性中可能包含.分隔符(如N3.N2.Y3),所以需要合并从索引5开始的所有部分
|
||||||
|
Dim fjgn As String
|
||||||
|
If UBound(dotParts) >= 5 Then
|
||||||
|
Dim instrumentFeature As String
|
||||||
|
Dim i As Long
|
||||||
|
instrumentFeature = ""
|
||||||
|
|
||||||
|
' 合并从索引5开始的所有部分,用.连接
|
||||||
|
For i = 5 To UBound(dotParts)
|
||||||
|
If instrumentFeature = "" Then
|
||||||
|
instrumentFeature = dotParts(i)
|
||||||
|
Else
|
||||||
|
instrumentFeature = instrumentFeature & "." & dotParts(i)
|
||||||
|
End If
|
||||||
|
Next i
|
||||||
|
|
||||||
|
instrumentFeature = Trim(instrumentFeature)
|
||||||
|
fjgn = ExtractAdditionalFeatures(instrumentFeature)
|
||||||
|
Else
|
||||||
|
' 如果没有仪表特性字段,fjgn为空
|
||||||
|
fjgn = ""
|
||||||
|
End If
|
||||||
|
pConditions.Add "fjgn", fjgn
|
||||||
|
|
||||||
ParseHeader = True
|
ParseHeader = True
|
||||||
Exit Function
|
Exit Function
|
||||||
|
|
||||||
@@ -230,3 +255,49 @@ Public Function GetAllConditions() As String
|
|||||||
|
|
||||||
GetAllConditions = result
|
GetAllConditions = result
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
'=====================================================================
|
||||||
|
' 方法: ExtractAdditionalFeatures
|
||||||
|
' 功能: 从仪表特性中提取附加功能
|
||||||
|
' 参数: instrumentFeature - 仪表特性字符串(如"N2,N3.Y3"或"Y3")
|
||||||
|
' 返回: String - 附加功能字符串,多个功能用逗号分隔
|
||||||
|
' 说明:
|
||||||
|
' 1. 识别并去除充油类型(位于最后,格式为Y+一位数字)
|
||||||
|
' 2. 统一分隔符处理(将.替换为,)
|
||||||
|
' 3. 去除可能的后缀分隔符
|
||||||
|
'=====================================================================
|
||||||
|
Private Function ExtractAdditionalFeatures(instrumentFeature As String) As String
|
||||||
|
On Error GoTo ErrorHandler
|
||||||
|
|
||||||
|
Dim result As String
|
||||||
|
result = Trim(instrumentFeature)
|
||||||
|
|
||||||
|
' 1. 检查是否以Y+数字结尾(充油类型)
|
||||||
|
If Len(result) >= 2 Then
|
||||||
|
Dim lastTwoChars As String
|
||||||
|
lastTwoChars = Right(result, 2)
|
||||||
|
|
||||||
|
' 检查最后两位是否为Y+数字
|
||||||
|
If UCase(Left(lastTwoChars, 1)) = "Y" And IsNumeric(Right(lastTwoChars, 1)) Then
|
||||||
|
' 去掉充油类型
|
||||||
|
result = Left(result, Len(result) - 2)
|
||||||
|
result = Trim(result)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
' 2. 处理可能的分隔符(,或.)
|
||||||
|
' 将可能的.替换为,,统一处理
|
||||||
|
result = Replace(result, ".", ",")
|
||||||
|
|
||||||
|
' 3. 去除可能的后缀分隔符
|
||||||
|
If Len(result) > 0 And Right(result, 1) = "," Then
|
||||||
|
result = Left(result, Len(result) - 1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
ExtractAdditionalFeatures = Trim(result)
|
||||||
|
Exit Function
|
||||||
|
|
||||||
|
ErrorHandler:
|
||||||
|
' 如果解析出错,返回空字符串
|
||||||
|
ExtractAdditionalFeatures = ""
|
||||||
|
End Function
|
||||||
@@ -9,7 +9,7 @@ Option Explicit
|
|||||||
' 常量定义
|
' 常量定义
|
||||||
'=====================================================================
|
'=====================================================================
|
||||||
' 提取条件配置
|
' 提取条件配置
|
||||||
Private Const CONDITION_CONFIG = "azxs,安装形式|bkxs,表壳形式|gclj,过程连接|jycz,接液材质|lcfw,量程范围"
|
Private Const CONDITION_CONFIG = "azxs,安装形式|bkxs,表壳形式|gclj,过程连接|jycz,接液材质|lcfw,量程范围|fjgn,附加功能"
|
||||||
' 行号基数
|
' 行号基数
|
||||||
Private Const ROW_NUMBER_BASE = 7000
|
Private Const ROW_NUMBER_BASE = 7000
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Option Explicit
|
|||||||
' 常量定义
|
' 常量定义
|
||||||
'=====================================================================
|
'=====================================================================
|
||||||
' 提取条件配置(可灵活扩展)
|
' 提取条件配置(可灵活扩展)
|
||||||
Private Const CONDITION_CONFIG = "azxs,安装形式|bkxs,表壳形式|gclj,过程连接|jycz,接液材质|lcfw,量程范围"
|
Private Const CONDITION_CONFIG = "azxs,安装形式|bkxs,表壳形式|gclj,过程连接|jycz,接液材质|lcfw,量程范围|fjgn,附加功能"
|
||||||
|
|
||||||
'=====================================================================
|
'=====================================================================
|
||||||
' 过程: ProcessProductModels
|
' 过程: ProcessProductModels
|
||||||
|
|||||||
Reference in New Issue
Block a user