feat: add component priority exclusion feature

Add support for excluding "部件" category based on component priority flag:
- BomExtractor: Add exclude categories functionality
  - Add pExcludeCategories collection member
  - Add SetExcludeCategories() and ClearExcludeCategories() methods
  - Modify DetermineRequiredCategories() to skip excluded categories

- BIPUploadModule: Read and use component priority field
  - Read component priority from column E of [产品订单] worksheet
  - Pass component priority to ProcessSingleOrder()
  - When priority is "否"/"0"/"FALSE", exclude "部件" category
  - Only extract sub-category materials when component priority is disabled

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-02-01 22:25:10 +08:00
parent 8fae8f0389
commit c5f2d804fb
2 changed files with 59 additions and 14 deletions

View File

@@ -91,11 +91,13 @@ Public Sub ProcessOrdersToBIP()
Dim productModel As String
Dim quantity As String
Dim productCode As String
Dim componentPriority As String
orderNumber = Trim(orderSheet.Cells(i, 1).value) ' A列生产订单号
productModel = Trim(orderSheet.Cells(i, 2).value) ' B列产品型号
quantity = Trim(orderSheet.Cells(i, 3).value) ' C列数量
productCode = Trim(orderSheet.Cells(i, 4).value) ' D列产品编码
componentPriority = Trim(orderSheet.Cells(i, 5).value) ' E列部件优先
' 跳过空行
If orderNumber = "" And productModel = "" Then
@@ -122,7 +124,7 @@ Public Sub ProcessOrdersToBIP()
' 处理单个订单
outputRow = ProcessSingleOrder(orderNumber, productModel, quantity, productCode, _
BomExtractor, bipSheet, outputRow)
componentPriority, BomExtractor, bipSheet, outputRow)
processedCount = processedCount + 1
ContinueLoop:
@@ -155,6 +157,7 @@ End Sub
' productModel - 产品型号
' quantity - 生产数量
' productCode - 产品编码
' componentPriority - 部件优先标志("是"或"否"
' BomExtractor - BOM提取器对象
' bipSheet - BIP上传模板工作表
' startRow - 起始行号
@@ -164,6 +167,7 @@ Private Function ProcessSingleOrder(orderNumber As String, _
productModel As String, _
quantity As String, _
productCode As String, _
componentPriority As String, _
BomExtractor As BomExtractor, _
bipSheet As Worksheet, _
startRow As Long) As Long
@@ -172,6 +176,14 @@ Private Function ProcessSingleOrder(orderNumber As String, _
Dim currentRow As Long
currentRow = startRow
' 根据部件优先设置排除类别
BomExtractor.ClearExcludeCategories
If UCase(componentPriority) = "否" Or componentPriority = "0" Or componentPriority = "FALSE" Then
Dim excludeCats As New collection
excludeCats.Add "部件"
BomExtractor.SetExcludeCategories excludeCats
End If
' 解析产品型号
Dim parser As ProductModelParser
Set parser = New ProductModelParser