Update frmAddSpec form

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-03-20 13:12:00 +08:00
parent 2d7ef5fc88
commit 0128c210f8

View File

@@ -31,11 +31,19 @@ Private Sub UserForm_Initialize()
Exit Sub
End If
' 初始化策略下拉框
' 初始化策略下拉框 (中文化显示,底层输出英文指令)
With Me.cboStrategy
.Clear
.AddItem "APPEND"
.AddItem "CLONE"
.ColumnCount = 2
.ColumnWidths = "180;0" ' 第一列中文可见,第二列英文标识隐藏
.BoundColumn = 2 ' 指定 .Value 属性读取隐藏的第二列
.AddItem "追加规格 (在原有条件上追加)"
.List(0, 1) = "APPEND"
.AddItem "克隆新增 (复制母版并生成新行)"
.List(1, 1) = "CLONE"
.ListIndex = 0 ' 默认选中 APPEND
End With
@@ -251,10 +259,11 @@ End Sub
' ==============================================================================
Private Sub btnExecute_Click()
' --- 校验输入 ---
Dim paramName As String, newValue As String, strategy As String
Dim paramName As String, newValue As String, strategy As String, strategyName As String
paramName = Trim(Me.cboParamName.Text)
newValue = Trim(Me.txtNewValue.Text)
strategy = Me.cboStrategy.value
strategy = Me.cboStrategy.value ' 获取隐藏的底层代码 (APPEND / CLONE)
strategyName = Me.cboStrategy.Text ' 获取界面显示的中文名称
If paramName = "" Or newValue = "" Then
MsgBox "参数名称和新增规格值不能为空!", vbExclamation
@@ -318,7 +327,7 @@ Private Sub btnExecute_Click()
End If
' --- 调用调度中枢进行外科手术 ---
Me.btnExecute.Caption = "正在锻造..."
Me.btnExecute.Caption = "正在处理..."
Me.btnExecute.Enabled = False
DoEvents ' 刷新UI防止假死
@@ -326,18 +335,18 @@ Private Sub btnExecute_Click()
mSpecAdditionManager.ExecutePipeline mTargetWorksheet, mGlobalBOMs, targetBOMs, paramName, newValue, strategy
' --- 完成与恢复 ---
Me.btnExecute.Caption = "锻造入库 (执行)"
Me.btnExecute.Caption = "保存入库 (执行)"
Me.btnExecute.Enabled = True
Me.txtNewValue.Text = ""
Me.lblLog.Caption = "成功![" & newValue & "] 规格已通过 " & strategy & " 策略注入完成。" & vbCrLf & actionLog
Me.lblLog.Caption = "成功![" & newValue & "] 规格已通过 [" & strategyName & "] 处理完成。" & vbCrLf & actionLog
Me.lblLog.ForeColor = RGB(0, 128, 0) ' 绿色
' 重新加载数据刷新UI
LoadDataAndRender
RefreshDetailsPanel
MsgBox "规格锻造完成!请查看表格确认结果。", vbInformation
MsgBox "规格新增完成!请查看表格确认结果。", vbInformation
End Sub
' 关闭按钮