Files
AutoBOM/docs/执行计划-附加功能支持.md
Misaka_Company 8545177bd5 docs: add ComponentInventoryCheckModule flowchart documentation
Add comprehensive flowchart documentation for the component inventory check module:
- Business flowchart (for non-technical users)
- Technical flowchart (for developers)
- Detailed inventory allocation process
- BOM parsing process
- Data processing sequence diagram
- Data structure documentation and execution examples

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 09:32:07 +08:00

200 lines
6.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 执行计划添加附加功能fjgn支持
## 一、需求概述
### 1.1 新增条件字段
- **条件代码**`fjgn`
- **条件名称**`附加功能`
- **提取位置**:从型号表头的[仪表特性]字段中提取第6个位置索引5
### 1.2 型号结构
```
[型号]-[公称外径].[安装形式].[壳体形式].[过程连接&接液材质].[量程范围].[仪表特性]
```
### 1.3 仪表特性解析规则
- **充油类型**:位于最后,格式为 `Y`+一位数字(如 Y3
- **附加功能**:在充油类型前面的内容
- 分隔符可能是 `,``.`(如 `N2,N3``N2.N3`
- 可能为空(如仪表特性只有 `Y3`
### 1.4 示例
| 型号 | 仪表特性 | 充油类型 | 附加功能 |
|------|----------|----------|----------|
| PYTHN-100.A0.541.M201.M06.N2,N3.Y3 | N2,N3.Y3 | Y3 | N2,N3 |
| YTHN-100.A0.531.M201.M08.Y3 | Y3 | Y3 | (空) |
---
## 二、条件评估规则
### 2.1 fjgn 条件的特殊处理
| 条件表达式 | 型号中的 fjgn | 评估结果 | 说明 |
|-----------|--------------|---------|------|
| fjgn=N1 | N1,N2 | ✅ True | 包含 N1 |
| fjgn=N1 | N2,N3 | ❌ False | 不包含 N1 |
| fjgn=N1 | (空) | ❌ False | 空值不包含任何值 |
| fjgn!=N1 | N1,N2 | ❌ False | 包含 N1不满足!= |
| fjgn!=N1 | N2,N3 | ✅ True | 不包含 N1 |
| fjgn!=N1 | (空) | ✅ True | 空值不包含 N1 |
### 2.2 匹配逻辑
- **等值匹配fjgn=XX**fjgn 字符串中包含指定值即为真
- **不等匹配fjgn!=XX**fjgn 字符串中不包含指定值即为真
- **空值处理**:空字符串不包含任何值
---
## 三、代码修改方案
### 3.1 ProductModelParser.cls
**修改位置**`ParseHeader()` 方法
**新增内容**
```vba
' 仪表特性 - 第6个位置(索引5),可能不存在
If UBound(dotParts) >= 5 Then
Dim instrumentFeature As String
instrumentFeature = Trim(dotParts(5))
' 提取附加功能
Dim fjgn As String
fjgn = ExtractAdditionalFeatures(instrumentFeature)
pConditions.Add "fjgn", fjgn
Else
' 如果没有仪表特性字段fjgn为空
pConditions.Add "fjgn", ""
End If
```
**新增方法**`ExtractAdditionalFeatures()`
```vba
Private Function ExtractAdditionalFeatures(instrumentFeature As String) As String
' 1. 检查是否以Y+数字结尾(充油类型)
Dim lastTwoChars As String
If Len(instrumentFeature) >= 2 Then
lastTwoChars = Right(instrumentFeature, 2)
If UCase(Left(lastTwoChars, 1)) = "Y" And IsNumeric(Right(lastTwoChars, 1)) Then
' 去掉充油类型
instrumentFeature = Left(instrumentFeature, Len(instrumentFeature) - 2)
instrumentFeature = Trim(instrumentFeature)
End If
End If
' 2. 处理可能的分隔符(,或.
' 将可能的.替换为,,统一处理
instrumentFeature = Replace(instrumentFeature, ".", ",")
' 3. 去除可能的后缀分隔符
If Right(instrumentFeature, 1) = "," Then
instrumentFeature = Left(instrumentFeature, Len(instrumentFeature) - 1)
End If
ExtractAdditionalFeatures = Trim(instrumentFeature)
End Function
```
---
### 3.2 BIPUploadModule.bas
**修改位置**第12行常量定义
**修改内容**
```vba
' 修改前
Private Const CONDITION_CONFIG = "azxs,安装形式|bkxs,表壳形式|gclj,过程连接|jycz,接液材质|lcfw,量程范围"
' 修改后
Private Const CONDITION_CONFIG = "azxs,安装形式|bkxs,表壳形式|gclj,过程连接|jycz,接液材质|lcfw,量程范围|fjgn,附加功能"
```
---
### 3.3 ConditionEvaluator.cls
**修改位置**`EvaluateSingleCondition()` 方法
**修改内容**:在现有的 `=``!=` 运算符处理后,添加 fjgn 特殊处理
```vba
' 在现有的 actualValue = Conditions(varName) 之后添加
actualValue = Conditions(varName)
' fjgn 字段特殊处理(多值匹配)
If varName = "fjgn" Then
If operator = "=" Then
' fjgn=N1检查actualValue中是否包含value
EvaluateSingleCondition = InStr(actualValue, value) > 0
ElseIf operator = "!=" Then
' fjgn!=N1检查actualValue中是否不包含value
EvaluateSingleCondition = InStr(actualValue, value) = 0
End If
Exit Function
End If
' 其他字段使用原有逻辑
EvaluateSingleCondition = (actualValue = value)
```
---
## 四、测试用例
### 4.1 解析测试
| 测试型号 | 预期 fjgn | 预期其他条件 |
|---------|----------|-------------|
| PYTHN-100.A0.541.M201.M06.N2,N3.Y3 | N2,N3 | azxs=A0, bkxs=541, gclj=M20, jycz=1, lcfw=M06 |
| YTHN-100.A0.531.M201.M08.Y3 | (空) | azxs=A0, bkxs=531, gclj=M20, jycz=1, lcfw=M08 |
| BP-088.2312.M08.0A3.N1.N2.Y2 | N1,N2 | azxs=23, bkxs=12, gclj=M08, jycz=0, lcfw=A3 |
| BP-088.2312.M08.0A3.Y2 | (空) | azxs=23, bkxs=12, gclj=M08, jycz=0, lcfw=A3 |
### 4.2 条件评估测试
| fjgn值 | 选用条件 | 预期结果 |
|-------|---------|---------|
| N1,N2 | fjgn=N1 | True |
| N1,N2 | fjgn=N3 | False |
| (空) | fjgn=N1 | False |
| N1,N2 | fjgn!=N1 | False |
| N1,N2 | fjgn!=N3 | True |
| (空) | fjgn!=N1 | True |
---
## 五、实施步骤
1. **修改 ProductModelParser.cls**
-`ParseHeader()` 方法中添加仪表特性提取逻辑
- 新增 `ExtractAdditionalFeatures()` 方法
2. **修改 BIPUploadModule.bas**
- 更新 `CONDITION_CONFIG` 常量
3. **修改 ConditionEvaluator.cls**
-`EvaluateSingleCondition()` 方法中添加 fjgn 特殊处理逻辑
4. **测试验证**
- 测试型号解析是否正确
- 测试条件评估是否符合预期
- 测试边界情况(空值、多个附加功能等)
---
## 六、风险评估
| 风险 | 影响 | 缓解措施 |
|------|------|---------|
| 旧型号缺少仪表特性字段 | 解析失败 | 判断字段是否存在,不存在时 fjgn 为空 |
| 充油类型识别错误 | 提取错误 | 严格匹配 Y+一位数字的格式 |
| 分隔符不一致 | 解析错误 | 统一将 `.` 替换为 `,` 处理 |
| 条件评估逻辑错误 | 匹配错误 | 充分测试各种边界情况 |
---
**是否批准此执行计划?确认后我将开始代码实现。**