📄 cpgb_gmz_cls.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsCPGB_GMZ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'定义 BillEvent 接口. 必须具有的声明, 以此来获得事件
Private WithEvents m_BillInterface As BillEvent
Attribute m_BillInterface.VB_VarHelpID = -1
Public Sub Show(ByVal oBillInterface As Object)
'BillEvent 接口实现
'注意: 此方法必须存在, 请勿修改
Set m_BillInterface = oBillInterface
SetSD
'MsgBox "Show"
End Sub
Private Sub Class_Terminate()
'释放接口对象
'注意: 此方法必须存在, 请勿修改
Set m_BillInterface = Nothing
End Sub
Private Sub SetSD()
If isOK Then
m_BillInterface.BillEntrys(1).BOSFields(7).FieldLock = False '毛重
m_BillInterface.BillEntrys(1).BOSFields(10).FieldLock = False '出厂时间
Else
m_BillInterface.BillEntrys(1).BOSFields(4).FieldLock = True '车牌号
m_BillInterface.BillEntrys(1).BOSFields(5).FieldLock = True '客户
m_BillInterface.BillEntrys(1).BOSFields(6).FieldLock = True '皮重
m_BillInterface.BillEntrys(1).BOSFields(9).FieldLock = True '进厂时间
m_BillInterface.BillEntrys(1).BOSFields(7).FieldLock = True '毛重
m_BillInterface.BillEntrys(1).BOSFields(10).FieldLock = True '出厂时间
m_BillInterface.BillEntrys(1).BOSFields(8).FieldLock = True '净重
End If
End Sub
Private Sub m_BillInterface_AddNewRow(ByVal Index As Integer, ByVal NewRow As Long)
' MsgBox "AddNewRow"
End Sub
Private Sub m_BillInterface_AfterLoadBill()
'MsgBox "AfterLoadBill"
End Sub
Private Sub m_BillInterface_MenuBarClick(ByVal BOSTool As K3ClassEvents.BOSTool, Cancel As Boolean)
'TODO: 请在此处添加代码响应事件 MenuBarClick
Select Case BOSTool.ToolName
Case "butPZGB"
'此处添加处理 butPZGB 菜单对象的 Click 事件
doGetPZ
Case "butJS"
'此处添加处理 butPZGB 菜单对象的 Click 事件
FrmPassword.Show 1
SetSD
Case "butJIAS"
'此处添加处理 butJIAS 菜单对象的 Click 事件
m_BillInterface.BillEntrys(1).BOSFields(7).FieldLock = True
m_BillInterface.BillEntrys(1).BOSFields(10).FieldLock = True
Case Else
End Select
End Sub
Private Sub m_BillInterface_MenuBarInitialize(ByVal oMenuBar As K3ClassEvents.MenuBar)
Dim oTool As K3ClassEvents.BOSTool
Dim oBand As K3ClassEvents.BOSBand
'*************** 开始新增 BOS 菜单 ***************
'新增 butPZGB 菜单对象,并设置属性
Set oTool = oMenuBar.BOSTools.Add("butPZGB")
With oTool
.Alignment = Enu_TACenterCenter
.BeginGroup = True
.Caption = "过磅"
.ToolTipText = "过磅"
.ShortcutKey = 0
.Visible = True
.Enabled = True
.CaptionPosition = Enu_TCPBelow
.Style = Enu_TSIconText
.BeginGroup = False
End With
Set oBand = oMenuBar.BOSBands("BandToolBar")
oBand.BOSTools.InsertBefore "mnuFileExit", oTool '将菜单对象插入指定工具栏
Set oTool = oMenuBar.BOSTools.Add("butJS")
With oTool
.Caption = "解锁"
.ToolTipText = "解锁"
.ShortcutKey = 0
.Visible = True
.Enabled = True
.CaptionPosition = Enu_TCPBelow
.Style = Enu_TSIconText
.BeginGroup = False
End With
Set oBand = oMenuBar.BOSBands("BandToolBar")
oBand.BOSTools.InsertBefore "mnuFileExit", oTool '将菜单对象插入指定工具栏
Set oTool = oMenuBar.BOSTools.Add("butJIAS")
With oTool
.Caption = "加锁"
.ToolTipText = "加锁"
.ShortcutKey = 0
.Visible = True
.Enabled = True
.CaptionPosition = Enu_TCPBelow
.Style = Enu_TSIconText
.BeginGroup = False
End With
Set oBand = oMenuBar.BOSBands("BandToolBar")
oBand.BOSTools.InsertBefore "mnuFileExit", oTool '将菜单对象插入指定工具栏
oMenuBar.Refresh
'*************** 结束新增 BOS 菜单 ***************
MsgBox "MenuBarInitialize"
InitCS
End Sub
Private Sub InitCS()
Dim Rt As ADODB.Recordset
Set Rt = m_BillInterface.K3Lib.GetData("select * from t_SystemProfile_NHG")
Rt.Filter = "FKey='GBXT-CKH'"
If Rt.EOF Then
Debug.Print "GBXT-CKH not found."
Else
strPort = NS(Rt!FValue)
End If
Rt.Filter = "FKey='GBXT-TXCS'"
If Rt.EOF Then
Debug.Print "GBXT-TXCS not found."
Else
strSetting = NS(Rt!FValue)
End If
Rt.Filter = "FKey='GBXT-JSMM'"
If Rt.EOF Then
Debug.Print "GBXT-JSMM not found."
Else
strPassword = NS(Rt!FValue)
End If
Rt.Filter = "FKey='GBXT-CPQZ'"
If Rt.EOF Then
Debug.Print "GBXT-CPQZ not found."
Else
strCar = NS(Rt!FValue)
End If
Rt.Filter = "FKey='GBXT-CEBFB'"
If Rt.EOF Then
Debug.Print "GBXT-CEBFB not found."
Else
strCEBFB = NS(Rt!FValue)
End If
Rt.Close
Set Rt = Nothing
isOK = False
End Sub
Private Sub doGetPZ()
Dim a
Dim ret As Integer
If Trim(m_BillInterface.BillEntrys(1).BOSFields(4).Value) = "" Then
MsgBox "请先选择车牌号码!"
Exit Sub
End If
If m_BillInterface.BillEntrys(1).BOSFields(7).Value <> "" Then
ret = MsgBox("车牌号(" + m_BillInterface.BillEntrys(1).BOSFields(4).Value + ")的重量已经存在,是否重新过磅?", vbYesNo)
If ret = vbNo Then Exit Sub
End If
Frmgb.Command1.Value = True
If Val(SjZl) = 0 Then
MsgBox "磅秤读数错误!"
Exit Sub
End If
m_BillInterface.BillEntrys(1).BOSFields(7).Value = SjZl
m_BillInterface.BillEntrys(1).BOSFields(10).Value = Now
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -