📄 producedrawmaterialform.frm
字号:
Height = 270
Left = 7800
TabIndex = 2
Text = "Text1"
Top = 120
Width = 975
End
End
End
Attribute VB_Name = "producedrawmaterialform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'**************************************
'* 模 块 名 称 :领料列表管理用户操作界面
'* 功 能 描 述 :领料列表管理用户操作界面
'* 程序员姓名 : 石春晓
'* 最后修改人 : 石春晓
'* 最后修改时间:2005/09/21
'**************************************
Option Explicit
Private m_producedrawmaterDAO As producedrawmaterialDAO ' 发料数据库操作类
Private m_recordset As ADODB.Recordset ' 数据操作数据集对象
Public produceId As String
Private m_idList As String ' 在执行查询时查询到的ID列表字符串
'**************************************
'* 功 能 描 述 :窗体加载函数
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub Form_Load()
Set m_producedrawmaterDAO = New producedrawmaterialDAO
Set m_recordset = New ADODB.Recordset
Me.caption = "领料清单"
SetToCenter Me
RefreshListTitle
SetToCenter Me
If produceId <> "" Then
RefreshList1
Else
refreshlist
End If
End Sub
Private Sub Form_Resize()
hfg_houseList.Height = Me.Height - 1400
hfg_houseList.Width = Me.Width - 350
If (hfg_houseList.Height > hfg_houseList.Height - 300) Or (hfg_houseList.Width > hfg_houseList.Width - 200) Then
hfg_houseList.Height = hfg_houseList.Height + 400
hfg_houseList.Width = hfg_houseList.Width + 200
End If
End Sub
Private Sub hfg_houseList_DblClick()
producedrawmaterialsingle.f = 1
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
producedrawmaterialsingle.m_cdmId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
producedrawmaterialsingle.show 1
End If
End Sub
'**************************************
'* 功 能 描 述 :工具栏按钮的单击操作按钮
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "xz" ' 新增
producedrawmaterialsingle.f = 0
producedrawmaterialsingle.produceId = produceId
producedrawmaterialsingle.show 1
producedrawmaterialsingle.produceId = ""
If produceId = "" Then
Call refreshlist
Else
Call RefreshList1
End If
Case "xg" ' 预览
producedrawmaterialsingle.f = 1
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
producedrawmaterialsingle.m_cdmId = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
producedrawmaterialsingle.show 1
End If
' Case "sc" ' 删除
' Call delete
' If produceid = "" Then
' Call RefreshList
' Else
' Call RefreshList1
' End If
Case "cx" ' 查询
Call Query
Case "sx" '刷 新
If produceId = "" Then
Call refreshlist
Else
Call RefreshList1
End If
Case "tc" '退 出
produceId = ""
Unload Me
End Select
End Sub
'**************************************
'* 功 能 描 述 :刷新仓库列表
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub refreshlist()
Dim currentrow As Integer ' 当前插入的行
m_producedrawmaterDAO.FindAll m_recordset
' Set hfg_houseList.DataSource = m_recordset ' 数据源绑定到显示控件
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
GetRecordToList m_recordset
m_recordset.Close
End Sub
'**************************************
'* 功 能 描 述 :删除一条记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub delete()
' If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) = "" Then
' MainForm.g_msgText = "请选择一条记录!"
' HMsgBox MainForm.g_msgText, 0, 1
' End If
'
' m_producedrawmaterDAO.DeleteById m_recordset, _
' Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
End Sub
'**************************************
'* 功 能 描 述 :刷新列表的标题栏
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub RefreshListTitle()
hfg_houseList.TextMatrix(0, 0) = "生产产品物料编号"
hfg_houseList.TextMatrix(0, 1) = "员工"
hfg_houseList.TextMatrix(0, 2) = "生产数量"
hfg_houseList.TextMatrix(0, 3) = "领料日期"
hfg_houseList.TextMatrix(0, 4) = "仓库名称"
hfg_houseList.TextMatrix(0, 5) = "产品名称"
hfg_houseList.TextMatrix(0, 6) = "生产编号"
hfg_houseList.TextMatrix(0, 7) = "produceid"
'设置列对齐方式 7-右对齐 5-居中对齐 2-左对齐
hfg_houseList.ColAlignment(0) = 2
hfg_houseList.ColAlignment(1) = 2
hfg_houseList.ColAlignment(2) = 8
hfg_houseList.ColAlignment(3) = 2
hfg_houseList.ColAlignment(4) = 2
hfg_houseList.ColAlignment(5) = 2
hfg_houseList.ColAlignment(6) = 2
hfg_houseList.ColAlignment(7) = 2
hfg_houseList.ColWidth(0) = 1
hfg_houseList.ColWidth(7) = 1
End Sub
'**************************************
'* 功 能 描 述 :查询记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub Query()
QueryFom.m_currentQuery = QUERY_PRODUCEDRAWMATERIAL
QueryFom.m_operateType = 1
QueryFom.show vbModal
' 如果此原料已有BOM记录,则调出些条BOM的信息
m_idList = MainForm.g_application.m_queryResultId
RefreshQueryList ' 显示查询到的结果
End Sub
Private Sub RefreshList1()
Dim currentrow As Integer ' 当前插入的行
m_producedrawmaterDAO.FindidAll m_recordset, Trim(produceId)
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
GetRecordToList m_recordset
m_recordset.Close
End Sub
Private Sub RefreshQueryList()
Dim ret As Boolean
' 显示查询到的结果
On Error GoTo EXITFUN
MainForm.g_application.m_databaseCon.m_adoConnection.BeginTrans ' 开始事务
InsertQueryIdList m_idList ' 把要显示的记录ID列表插入临时表
ret = m_producedrawmaterDAO.producedrawmaterial_findidList(m_recordset) ' 查找记录
MainForm.g_application.m_databaseCon.m_adoConnection.CommitTrans ' 提交事务
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
If ret Then
GetRecordToList m_recordset
End If
Text1.text = Trim(m_recordset.RecordCount)
m_recordset.Close
Exit Sub
EXITFUN:
MainForm.g_application.m_databaseCon.m_adoConnection.RollbackTrans ' 回滚事务
End Sub
'**************************************
'* 功 能 描 述 :从数据集中取出记录在列表中显示
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub GetRecordToList(recSet As ADODB.Recordset)
Dim currentrow As Integer
With m_recordset
' hfg_houseList.Rows = m_recordset.RecordCount
currentrow = 1
Do While Not .EOF
If currentrow > hfg_houseList.Rows - 1 Then
hfg_houseList.AddItem ""
End If
'[>>自定义填充内容
hfg_houseList.TextMatrix(currentrow, 0) = Trim(.Fields(0) & " ")
hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields("员工") & " ")
hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields("生产数量") & " ")
hfg_houseList.TextMatrix(currentrow, 3) = Trim(.Fields("领料日期") & " ")
hfg_houseList.TextMatrix(currentrow, 4) = Trim(.Fields("仓库名称") & " ")
hfg_houseList.TextMatrix(currentrow, 5) = Trim(.Fields("产品名称") & " ")
hfg_houseList.TextMatrix(currentrow, 6) = Trim(.Fields("生产编号") & " ")
hfg_houseList.TextMatrix(currentrow, 7) = Trim(produceId)
'<<]
'设置数据行高度(Fixed)
hfg_houseList.RowHeight(currentrow) = 200
'动态集指针加1,同时将计数器加1(Fixed)
.MoveNext
currentrow = currentrow + 1
Loop
End With
Text1.text = Trim(m_recordset.RecordCount)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -