?? frmplang.frm
字號:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmPLANG
Caption = "計劃單信息"
ClientHeight = 6135
ClientLeft = 45
ClientTop = 345
ClientWidth = 8190
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6135
ScaleWidth = 8190
WindowState = 2 'Maximized
Begin VB.TextBox txtJLDW
Height = 372
Left = 7680
TabIndex = 19
Top = 5040
Visible = 0 'False
Width = 252
End
Begin VB.TextBox txtWZMC
Height = 372
Left = 7200
TabIndex = 18
Top = 5040
Visible = 0 'False
Width = 252
End
Begin VB.TextBox txtWZDM
Height = 372
Left = 360
TabIndex = 17
Top = 5520
Visible = 0 'False
Width = 252
End
Begin VB.TextBox txt_YWDM
Height = 372
Left = 0
TabIndex = 16
Top = 5520
Visible = 0 'False
Width = 252
End
Begin VB.TextBox txtM_DATE
Height = 372
Left = 480
TabIndex = 15
Top = 5040
Visible = 0 'False
Width = 252
End
Begin VB.TextBox txtM_NO
Height = 372
Left = 0
TabIndex = 14
Top = 5040
Visible = 0 'False
Width = 252
End
Begin VB.Frame Frame2
Caption = "記錄操作"
Height = 972
Left = 960
TabIndex = 10
Top = 5040
Width = 6000
Begin VB.CommandButton Command1
Caption = "確定計劃單"
Height = 375
Left = 4560
TabIndex = 20
Top = 360
Width = 1335
End
Begin VB.CommandButton cmdAdd
Caption = "添加產品信息"
Height = 375
Left = 240
TabIndex = 13
Top = 360
Width = 1335
End
Begin VB.CommandButton cmdModify
Caption = "修改產品信息"
Height = 375
Left = 1680
TabIndex = 12
Top = 360
Width = 1335
End
Begin VB.CommandButton cmdDelete
Caption = "刪除產品信息"
Height = 375
Left = 3120
TabIndex = 11
Top = 360
Width = 1335
End
End
Begin VB.Frame Frame1
Caption = "計劃單基本信息:"
Height = 840
Index = 0
Left = 120
TabIndex = 2
Top = 10
Width = 7932
Begin VB.TextBox txtItem
Height = 270
Index = 0
Left = 1200
MaxLength = 20
TabIndex = 5
Top = 360
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 288
Index = 0
Left = 5760
Style = 2 'Dropdown List
TabIndex = 4
Top = 360
Width = 2052
End
Begin VB.TextBox txtItem
Height = 270
Index = 1
Left = 3600
MaxLength = 20
TabIndex = 3
Top = 360
Width = 1335
End
Begin VB.Label Label2
Caption = "業務員:"
Height = 252
Index = 3
Left = 5040
TabIndex = 8
Top = 360
Width = 1092
End
Begin VB.Label Label2
Caption = "計劃單編號:"
Height = 252
Index = 0
Left = 120
TabIndex = 7
Top = 360
Width = 1092
End
Begin VB.Label Label2
Caption = "日 期:"
Height = 252
Index = 5
Left = 2640
TabIndex = 6
Top = 360
Width = 1092
End
End
Begin VB.Frame Frame1
Caption = "產品信息"
Height = 3972
Index = 1
Left = 120
TabIndex = 0
Top = 960
Width = 7932
Begin MSFlexGridLib.MSFlexGrid msgList
Height = 3252
Left = 120
TabIndex = 1
Top = 240
Width = 7692
_ExtentX = 13573
_ExtentY = 5741
_Version = 393216
Cols = 4
FixedCols = 2
AllowUserResizing= 1
End
End
Begin VB.Label lblTitle
Caption = "生 產 配 料 單 設 置 信 息 列 表"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 252
Left = 480
TabIndex = 9
Top = 240
Visible = 0 'False
Width = 5532
End
End
Attribute VB_Name = "frmPLANG"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
Private Sub cmdAdd_Click()
If gintPLANGLISTmode = 1 Then
If Trim(txtItem(0)) <> "" And Trim(Combo1(0)) <> "" Then
txtSQL = "select * from plang where pl_no ='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "已經存在相同編號的計劃單記錄!", vbOKOnly + vbExclamation, "警告"
txtItem(0).SetFocus
mrc.Close
Exit Sub
End If
frmPLANG1.txtM_NO = Trim(txtItem(0))
frmPLANG1.txtM_DATE = Trim(txtItem(1))
frmPLANG1.txtYWDM = Trim(Combo1(0).ItemData(Combo1(0).ListIndex))
gintPLANGmode = 1
frmPLANG1.Show 1
Else
MsgBox "請設置生產計劃單的所有選項!", vbOKOnly, "警告"
Exit Sub
End If
ElseIf gintPLANGLISTmode = 2 Then
frmPLANG1.txtM_NO = Trim(txtItem(0))
frmPLANG1.txtM_DATE = Trim(txtItem(1))
frmPLANG1.txtYWDM = Trim(Combo1(0).ItemData(Combo1(0).ListIndex))
gintPLANGmode = 1
frmPLANG1.Show 1
End If
End Sub
Private Sub cmdDelete_Click()
Dim txtSQL As String
Dim intCount As Integer
Dim mrc As ADODB.Recordset
Dim MsgText As String
If msgList.Rows > 1 Then
If MsgBox("真的要刪除編號為" & Trim(msgList.TextMatrix(msgList.Row, 1)) & "的原材料記錄嗎?", vbOKCancel + vbExclamation, "警告") = vbOK Then
intCount = msgList.Row
txtSQL = "delete from plang where pl_no ='" & Trim(msgList.TextMatrix(intCount, 1)) & "' and dm = '" & Trim(msgList.TextMatrix(intCount, 2)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
'Unload frmPLANG
'Unload frmPLANGLIST
'frmPLANGLIST.txtSQL = "select * from plang"
'frmPLANGLIST.Show 0
'Unload Me
frmPLANG.txtSQL = "select pl_no,dm,mc,jldw,pl_sl,dj,jine,cp_date,st_date,bz from plang where pl_no ='" & Trim(txtItem(0)) & "'"
frmPLANG.ShowData
End If
End If
End Sub
Private Sub cmdModify_Click()
Dim intCount As Integer
If msgList.Rows > 1 Then
gintPLANGmode = 2
intCount = msgList.Row
If intCount > 0 Then
frmPLANG1.txtSQL = "select dm,mc,jldw,pl_sl,dj,jine,cp_date,st_date from plang where pl_no ='" & Trim(msgList.TextMatrix(intCount, 1)) & "' and dm = '" & Trim(msgList.TextMatrix(intCount, 2)) & "'"
'frmPLANG1.txtSQL = "select dm,mc,jldw,pl_sl,dj,jine,cp_date,st_date,bz from plang where pl_no ='1'"
frmPLANG1.txtM_NO = Trim(txtItem(0))
frmPLANG1.txtM_DATE = Trim(txtItem(1))
frmPLANG1.txtYWDM = Trim(Combo1(0).ItemData(Combo1(0).ListIndex))
frmPLANG1.Show 1
Else
MsgBox "警告", vbOKOnly + vbExclamation, "請首先選擇需要修改的紀錄!"
End If
End If
End Sub
Private Sub Combo1_Click(Index As Integer)
If Index = 1 Then
txtSQL = "select dm,jldw from dm_wz where mc = '" & Trim(Combo1(1)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
txtItem(2) = mrc.Fields(0)
txtItem(3) = mrc.Fields(1)
End If
mrc.Close
End If
End Sub
Private Sub Command1_Click()
Unload Me
Unload frmPLANGLIST
frmPLANGLIST.txtSQL = "select * from plang"
frmPLANGLIST.Show 0
End Sub
Private Sub Form_Load()
If gintPLANGLISTmode = 1 Then
ShowTitle
txtSQL = "select dm,mc from dm_ywy"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
Do While Not mrc.EOF
Combo1(0).AddItem mrc.Fields(1)
Combo1(0).ItemData(Combo1(0).NewIndex) = mrc.Fields(0)
mrc.MoveNext
Loop
End If
mrc.Close
ElseIf gintPLANGLISTmode = 2 Then
ShowTitle
ShowData
End If
txtItem(1) = Format(Now, "yyyy-mm-dd")
End Sub
Private Sub Form_Resize()
If Me.WindowState <> vbMinimized And fMainForm.WindowState <> vbMinimized Then
'邊界處理
If Me.ScaleHeight < 10 * lblTitle.Height Then
Exit Sub
End If
If Me.ScaleWidth < lblTitle.Width + lblTitle.Width / 2 Then
Exit Sub
End If
'控制控件的位置
lblTitle.Top = lblTitle.Height
lblTitle.Left = (Me.Width - lblTitle.Width) / 2
Frame1(0).Left = (Me.Width - Frame1(0).Width) / 2
Frame1(1).Top = 1320
Frame1(1).Width = Me.ScaleWidth - 200
Frame1(1).Left = Me.ScaleLeft + 100
Frame1(1).Height = Me.ScaleHeight - 2500
msgList.Top = 240
msgList.Width = Me.ScaleWidth - 500
msgList.Left = Frame1(1).Left + 10
msgList.Height = Me.ScaleHeight - 3000
Frame2.Top = Frame1(1).Top + Frame1(1).Height + 50
Frame2.Left = Me.ScaleWidth / 2 - 3000
End If
End Sub
Public Sub FormClose()
Unload Me
End Sub
Public Sub ShowData()
Dim j As Integer
Dim i As Integer
Dim MsgText As String
Set mrc = ExecuteSQL(txtSQL, MsgText)
With msgList
.Rows = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
If Not IsNull(Trim(mrc.Fields(i - 1))) Then
Select Case mrc.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
End Select
End If
Next i
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
'顯示Grid表頭
Private Sub ShowTitle()
Dim i As Integer
'select pl_no,dm,mc,jldw,pl_sl,dj,jine,cp_date,st_date,bz from plang where pl_no ='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
With msgList
.Cols = 11
.TextMatrix(0, 1) = "生產計劃單編號"
.TextMatrix(0, 2) = "產品編號"
.TextMatrix(0, 3) = "產品名稱"
.TextMatrix(0, 4) = "計量單位"
.TextMatrix(0, 5) = "數量"
.TextMatrix(0, 6) = "單價"
.TextMatrix(0, 7) = "總金額"
.TextMatrix(0, 8) = "開始日期"
.TextMatrix(0, 9) = "結束日期"
.TextMatrix(0, 10) = "備注信息"
'固定表頭
.FixedRows = 1
'設置各列的對齊方式
For i = 0 To 10
.ColAlignment(i) = 0
Next i
'表頭項居中
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
'設置單元大小
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 2000
.ColWidth(3) = 1000
.ColWidth(4) = 1000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 1000
.ColWidth(9) = 1000
.ColWidth(10) = 1000
.Row = 1
End With
End Sub
Private Sub msgList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'右鍵彈出
If Button = 2 And Shift = 0 Then
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -