📄 cooperateloss_list.frm
字号:
BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "CooperateLoss_list.frx":76DA
Key = "Total"
EndProperty
BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "CooperateLoss_list.frx":7A74
Key = "Detail"
EndProperty
BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "CooperateLoss_list.frx":7E0E
Key = "Order"
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "CooperateLoss_list"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************************
'* 模 块 名 称 :外协报损
'* 功 能 描 述 :外协报损
'* 程序员姓名 :黄朝和
'* 最后修改人 :
'* 最后修改时间:
'* 备 注:
'*******************************************************
Option Explicit
Public m_cooperateId As String
Private m_recordset As ADODB.Recordset
Private m_cooperatelossDAO As CooperateLossDAO
Public rownameredo As String
Private m_EmployeeDAO As employeeDAO
Private m_queryType As Integer
Private g_recordset As ADODB.Recordset
Private m_idList As String ' 在执行查询时查询到的ID列表字符串
Private Sub showform()
MSHFlexGrid1.TextMatrix(0, 0) = "报损编号"
MSHFlexGrid1.TextMatrix(0, 1) = "外协商"
MSHFlexGrid1.TextMatrix(0, 2) = "外协编号"
MSHFlexGrid1.TextMatrix(0, 3) = "报损数量"
MSHFlexGrid1.TextMatrix(0, 4) = "报损时间"
MSHFlexGrid1.TextMatrix(0, 5) = "备注"
MSHFlexGrid1.TextMatrix(0, 6) = "检验员"
MSHFlexGrid1.TextMatrix(0, 7) = "核检员"
MSHFlexGrid1.TextMatrix(0, 8) = "完成状态"
'设置列对齐方式 7-右对齐 5-居中对齐 2-左对齐
MSHFlexGrid1.ColAlignment(0) = 2
MSHFlexGrid1.ColAlignment(1) = 2
MSHFlexGrid1.ColAlignment(2) = 2
MSHFlexGrid1.ColAlignment(3) = 8
MSHFlexGrid1.ColAlignment(4) = 2
MSHFlexGrid1.ColAlignment(5) = 2
MSHFlexGrid1.ColAlignment(6) = 2
MSHFlexGrid1.ColAlignment(7) = 2
MSHFlexGrid1.ColAlignment(8) = 2
MSHFlexGrid1.ColWidth(0) = 5
MSHFlexGrid1.ColWidth(8) = 1
MSHFlexGrid1.ColWidth(1) = 1000
MSHFlexGrid1.ColWidth(2) = 2200
End Sub
Private Sub Combo1_Click()
If Combo1 = "未完成" Then
m_queryType = 0
If m_cooperateId <> "" Then
Call sxjl1
Else
sxjl
End If
End If
If Combo1 = "已完成" Then
m_queryType = 1
If m_cooperateId <> "" Then
Call sxjl1
Else
sxjl
End If
End If
End Sub
Private Sub Form_Load()
SetToCenter Me
Set m_recordset = New ADODB.Recordset
Set m_cooperatelossDAO = New CooperateLossDAO
Set g_recordset = New ADODB.Recordset
Set m_EmployeeDAO = New employeeDAO
Combo1.AddItem "未完成"
Combo1.AddItem "已完成"
Combo1.ListIndex = 0
If m_cooperateId <> "" Then
sxjl1
Else
sxjl
End If
End Sub
Private Sub Form_Resize()
MSHFlexGrid1.Height = Me.Height - 1400
MSHFlexGrid1.Width = Me.Width - 350
If (MSHFlexGrid1.Height > MSHFlexGrid1.Height - 300) Or (MSHFlexGrid1.Width > MSHFlexGrid1.Width - 200) Then
MSHFlexGrid1.Height = MSHFlexGrid1.Height + 400
MSHFlexGrid1.Width = MSHFlexGrid1.Width + 200
End If
End Sub
Private Sub MSHFlexGrid1_DblClick()
' 预览
If Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0)) <> "" Then
CooperateLoss.lossid = Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0))
CooperateLoss.show 1
Else
MainForm.g_msgText = "对不起您的操作有误,请重试!!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Exit Sub
End If
End Sub
Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "sx"
If m_cooperateId <> "" Then
Call sxjl1
Else
sxjl
End If
Case "yl"
If Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0)) <> "" Then
CooperateLoss.lossid = Trim(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0))
CooperateLoss.show 1
Else
MainForm.g_msgText = "对不起您的操作有误,请重试!!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Exit Sub
End If
Case "cx"
Call cxjl
Case "tc"
Unload Me
End Select
End Sub
Private Sub cxjl()
QueryFom.m_currentQuery = QUERY_COOPERATELOSS
QueryFom.m_operateType = 1
QueryFom.show 1
' 如果此原料已有BOM记录,则调出些条BOM的信息
m_idList = MainForm.g_application.m_queryResultId
RefreshQueryList
End Sub
Private Sub sxjl1()
Dim ret As Boolean
ret = m_cooperatelossDAO.cooperateloss_show(m_recordset, m_cooperateId, m_queryType)
MSHFlexGrid1.clear
MSHFlexGrid1.Rows = 2 ' 清空该控件的内容
Call showform
GetRecordToList m_recordset
m_recordset.Close
End Sub
Private Sub sxjl()
Dim ret As Boolean
Dim currentrow As Integer
ret = m_cooperatelossDAO.cooperateloss_all(m_recordset, m_queryType)
MSHFlexGrid1.clear
MSHFlexGrid1.Rows = 2 ' 清空该控件的内容
Call showform
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_cooperatelossDAO.cooperateloss_showidList(m_recordset) ' 查找记录
MainForm.g_application.m_databaseCon.m_adoConnection.CommitTrans ' 提交事务
MSHFlexGrid1.clear
MSHFlexGrid1.Rows = 2 ' 清空该控件的内容
Call showform
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
currentrow = 1 ' 赋初值
Do While Not .EOF
If currentrow > MSHFlexGrid1.Rows - 1 Then
MSHFlexGrid1.AddItem ""
End If
'[>>自定义填充内容
MSHFlexGrid1.TextMatrix(currentrow, 0) = Trim(.Fields(0))
MSHFlexGrid1.TextMatrix(currentrow, 1) = Trim(.Fields(1))
MSHFlexGrid1.TextMatrix(currentrow, 2) = Trim(.Fields(2))
MSHFlexGrid1.TextMatrix(currentrow, 3) = Trim(.Fields(4))
MSHFlexGrid1.TextMatrix(currentrow, 4) = Trim(.Fields(5))
MSHFlexGrid1.TextMatrix(currentrow, 5) = Trim(.Fields(6))
If Trim(.Fields("检验员")) = "" Then
MSHFlexGrid1.TextMatrix(currentrow, 6) = "未检验"
Else
m_EmployeeDAO.FindById g_recordset, Trim(.Fields("检验员"))
MSHFlexGrid1.TextMatrix(currentrow, 6) = Trim(g_recordset.Fields("员工姓名"))
g_recordset.Close
End If
If Trim(.Fields("核检员")) = "" Then
MSHFlexGrid1.TextMatrix(currentrow, 7) = "未核检"
Else
m_EmployeeDAO.FindById g_recordset, Trim(.Fields("核检员"))
MSHFlexGrid1.TextMatrix(currentrow, 7) = Trim(g_recordset.Fields("员工姓名"))
g_recordset.Close
End If
If Trim(.Fields("完成状态")) = 1 Then
MSHFlexGrid1.TextMatrix(currentrow, 8) = "完成报损"
Else
MSHFlexGrid1.TextMatrix(currentrow, 8) = "未完成报损"
End If
'<<]
'动态集指针加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 + -