📄 leddis.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form1
Caption = "电子看板"
ClientHeight = 10710
ClientLeft = 60
ClientTop = 750
ClientWidth = 15240
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 10710
ScaleWidth = 15240
StartUpPosition = 2 '屏幕中心
Begin 工程1.MorphDisplay MorphDisplay1
Height = 2985
Left = 5280
TabIndex = 4
Top = 0
Width = 9285
_ExtentX = 16378
_ExtentY = 5265
NumDigits = 5
SegmentHeight = 80
SegmentStyle = 0
SegmentStyleExp = 0
SegmentWidth = 20
ShowBurnIn = 0 'False
ShowExponent = 0 'False
XOffset = 40
End
Begin VB.CommandButton Command1
Caption = "完成输入"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 840
TabIndex = 0
Top = 9600
Width = 3615
End
Begin VB.Timer Timer1
Interval = 900
Left = 3600
Top = 3000
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 2160
Top = 6960
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin 工程1.MorphDisplay MorphDisplay2
Height = 2985
Left = 5280
TabIndex = 5
Top = 3240
Width = 9285
_ExtentX = 16378
_ExtentY = 5265
NumDigits = 5
SegmentHeight = 80
SegmentLitColor = 65535
SegmentLitColorNeg= 65535
SegmentStyle = 0
SegmentStyleExp = 0
SegmentWidth = 20
ShowBurnIn = 0 'False
ShowExponent = 0 'False
XOffset = 40
End
Begin 工程1.MorphDisplay MorphDisplay3
Height = 2985
Left = 5280
TabIndex = 6
Top = 6480
Width = 9285
_ExtentX = 16378
_ExtentY = 5265
NumDigits = 5
SegmentHeight = 80
SegmentLitColor = 255
SegmentLitColorNeg= 255
SegmentStyle = 0
SegmentStyleExp = 0
SegmentWidth = 20
ShowBurnIn = 0 'False
ShowExponent = 0 'False
XOffset = 40
End
Begin VB.Label Label1
Caption = "计划完成量"
BeginProperty Font
Name = "宋体"
Size = 72
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2775
Left = 240
TabIndex = 3
Top = 120
Width = 5040
End
Begin VB.Label Label2
Caption = "实际完成量"
BeginProperty Font
Name = "宋体"
Size = 72
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2775
Left = 240
TabIndex = 2
Top = 3360
Width = 5040
End
Begin VB.Label Label3
Caption = "差异量"
BeginProperty Font
Name = "宋体"
Size = 72
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2775
Left = 240
TabIndex = 1
Top = 6600
Width = 5040
End
Begin VB.Menu Set
Caption = "设定"
Begin VB.Menu 参数设定
Caption = "参数设定"
End
Begin VB.Menu 退出
Caption = "退出"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Flag As Integer
Public DifTime1, DifTime2, DifTime3, DifTime4 As Double
Private Sub Command1_Click()
Dim Plan, Diff As Integer
Flag = Flag + 1
MorphDisplay2.Value = Flag
MorphDisplay3.Value = Flag - MorphDisplay1.Value
If MorphDisplay3.Value > 0 Then '实际小于计划显示为红色,否则显示为绿色
MorphDisplay3.SegmentLitColor = &HFF00&
Else
MorphDisplay3.SegmentLitColor = &HFF&
End If
Plan = CInt(MorphDisplay1.Value)
Diff = MorphDisplay3.Value
Me.WriteLog Plan, Flag, Diff '记录日志
End Sub
Private Sub Form_Load()
Dim i As Integer
Flag = 0
TactTime = 36
IniTime = CDbl(Date + #8:30:00 AM#)
MorRestTimeFrom = CDbl(Date + #10:30:00 AM#)
MorRestTimeTo = CDbl(Date + #10:40:00 AM#)
LauchTimeFrom = CDbl(Date + #12:10:00 PM#)
LauchTimeTo = CDbl(Date + #1:45:00 PM#)
AftRestTimeFrom = CDbl(Date + #3:30:00 PM#)
AftRestTimeTo = CDbl(Date + #3:40:00 PM#)
SupTimeFrom = CDbl(Date + #5:10:00 PM#)
SupTimeTo = CDbl(Date + #6:15:00 PM#)
EndTime = CDbl(Now)
DifTime1 = MorRestTimeTo - MorRestTimeFrom
DifTime2 = LauchTimeTo - LauchTimeFrom
DifTime3 = AftRestTimeTo - AftRestTimeFrom
DifTime4 = SupTimeTo - SupTimeFrom
'初始化各显示值
If EndTime < IniTime Then
MorphDisplay1.Value = 0
MorphDisplay3.Value = 0
MorphDisplay2.Value = 0
End If
If (EndTime > IniTime And EndTime < MorRestTimeTo) Then
MorphDisplay1.Value = Int((EndTime - IniTime) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
MorphDisplay2.Value = Flag
End If
If (EndTime > MorRestTimeTo And EndTime < LauchTimeTo) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
MorphDisplay2.Value = Flag
End If
If (EndTime > LauchTimeTo And EndTime < AftRestTimeTo) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1 - DifTime2) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
MorphDisplay2.Value = Flag
End If
If (EndTime > AftRestTimeTo And EndTime < SupTimeTo) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1 - DifTime2 - DifTime3) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
MorphDisplay2.Value = Flag
End If
If (EndTime > SupTimeTo) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1 - DifTime2 - DifTime3 - DifTime4) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
MorphDisplay2.Value = Flag
End If
Dim R As Integer
MyMenu = GetSystemMenu(Me.hwnd, 0)
RemoveMenu MyMenu, &HF060, R
End Sub
Private Sub Timer1_Timer()
Dim EndTime As Double
EndTime = CDbl(Now)
DifTime1 = MorRestTimeTo - MorRestTimeFrom
DifTime2 = LauchTimeTo - LauchTimeFrom
DifTime3 = AftRestTimeTo - AftRestTimeFrom
DifTime4 = SupTimeTo - SupTimeFrom
If (EndTime > MorRestTimeFrom And EndTime < MorRestTimeTo) Or (EndTime > LauchTimeFrom And EndTime < LauchTimeTo) _
Or (EndTime > AftRestTimeFrom And EndTime < AftRestTimeTo) Or (EndTime > SupTimeFrom And EndTime < SupTimeTo) Then
Exit Sub
Else
If EndTime < IniTime Then
MorphDisplay1.Value = 0
MorphDisplay3.Value = 0
MorphDisplay2.Value = 0
End If
If (EndTime > IniTime And EndTime < MorRestTimeFrom) Then
MorphDisplay1.Value = Int((EndTime - IniTime) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
End If
If (EndTime > MorRestTimeTo And EndTime < LauchTimeFrom) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
End If
If (EndTime > LauchTimeTo And EndTime < AftRestTimeFrom) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1 - DifTime2) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
End If
If (EndTime > AftRestTimeTo And EndTime < SupTimeFrom) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1 - DifTime2 - DifTime3) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
End If
If (EndTime > SupTimeTo) Then
MorphDisplay1.Value = Int((EndTime - IniTime - DifTime1 - DifTime2 - DifTime3 - DifTime4) * 3600 * 24 / TactTime)
MorphDisplay3.Value = Flag - MorphDisplay1.Value
End If
End If
End Sub
Public Function WriteLog(ByVal PlanNum As Integer, ByVal FactNum As Integer, ByVal DiffNum As Single)
On Error Resume Next
DataPath = App.Path + "\LedDisplay.mdb"
Me.Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DataPath + ";Persist Security Info=False" + ";Jet OLEDB:Database Password=prowind"
Me.Adodc1.RecordSource = "select * from log"
Me.Adodc1.Refresh
If Me.Adodc1.Recordset.RecordCount > 0 Then
Me.Adodc1.Recordset.MoveLast
End If
'添加系统日志记录
With Me.Adodc1
.Recordset.AddNew
.Recordset.Fields("时间").Value = Date + Time
.Recordset.Fields("计划量").Value = PlanNum
.Recordset.Fields("实际量").Value = FactNum
.Recordset.Fields("差异量").Value = DiffNum
.Recordset.Update
.Refresh
.Recordset.Close
.Recordset.ActiveConnection = Nothing
End With
End Function
Private Sub 参数设定_Click()
Form2.Show
End Sub
Private Sub 退出_Click()
If MsgBox("退出系统将会导致数据丢失,确定要退出吗?", vbYesNo + vbExclamation, "警告") = vbYes Then
Unload Me
Else
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -