上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:35k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form Xt_Control 
  5.    Caption         =   "桌面"
  6.    ClientHeight    =   5850
  7.    ClientLeft      =   675
  8.    ClientTop       =   1665
  9.    ClientWidth     =   9240
  10.    Icon            =   "系统_主操作桌面.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   5850
  14.    ScaleWidth      =   9240
  15.    WindowState     =   2  'Maximized
  16.    Begin VB.PictureBox picSplitter 
  17.       BackColor       =   &H00808080&
  18.       BorderStyle     =   0  'None
  19.       FillColor       =   &H00808080&
  20.       BeginProperty Font 
  21.          Name            =   "MS Sans Serif"
  22.          Size            =   8.25
  23.          Charset         =   0
  24.          Weight          =   400
  25.          Underline       =   0   'False
  26.          Italic          =   0   'False
  27.          Strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   4800
  30.       Left            =   4740
  31.       ScaleHeight     =   2090.126
  32.       ScaleMode       =   0  'User
  33.       ScaleWidth      =   780
  34.       TabIndex        =   0
  35.       Top             =   780
  36.       Visible         =   0   'False
  37.       Width           =   72
  38.    End
  39.    Begin MSComctlLib.ImageList ImageList1 
  40.       Left            =   5250
  41.       Top             =   2340
  42.       _ExtentX        =   1005
  43.       _ExtentY        =   1005
  44.       BackColor       =   -2147483643
  45.       ImageWidth      =   16
  46.       ImageHeight     =   16
  47.       MaskColor       =   12632256
  48.       _Version        =   393216
  49.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  50.          NumListImages   =   7
  51.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  52.             Picture         =   "系统_主操作桌面.frx":1042
  53.             Key             =   "stb"
  54.          EndProperty
  55.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  56.             Picture         =   "系统_主操作桌面.frx":2094
  57.             Key             =   "xttb"
  58.          EndProperty
  59.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  60.             Picture         =   "系统_主操作桌面.frx":30E6
  61.             Key             =   "szk"
  62.          EndProperty
  63.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  64.             Picture         =   "系统_主操作桌面.frx":3480
  65.             Key             =   "gnqx1"
  66.          EndProperty
  67.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  68.             Picture         =   "系统_主操作桌面.frx":38D2
  69.             Key             =   ""
  70.          EndProperty
  71.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  72.             Picture         =   "系统_主操作桌面.frx":41AC
  73.             Key             =   "gnqx"
  74.          EndProperty
  75.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  76.             Picture         =   "系统_主操作桌面.frx":4546
  77.             Key             =   "kpgl"
  78.          EndProperty
  79.       EndProperty
  80.    End
  81.    Begin MSComctlLib.ListView lvListView 
  82.       Height          =   4335
  83.       Left            =   2190
  84.       TabIndex        =   5
  85.       Top             =   690
  86.       Width           =   1425
  87.       _ExtentX        =   2514
  88.       _ExtentY        =   7646
  89.       Arrange         =   2
  90.       LabelEdit       =   1
  91.       LabelWrap       =   -1  'True
  92.       HideSelection   =   -1  'True
  93.       OLEDragMode     =   1
  94.       OLEDropMode     =   1
  95.       PictureAlignment=   1
  96.       _Version        =   393217
  97.       Icons           =   "ImageList2"
  98.       SmallIcons      =   "ImageList1"
  99.       ColHdrIcons     =   "ImageList1"
  100.       ForeColor       =   -2147483640
  101.       BackColor       =   -2147483643
  102.       BorderStyle     =   1
  103.       Appearance      =   1
  104.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  105.          Name            =   "宋体"
  106.          Size            =   9
  107.          Charset         =   134
  108.          Weight          =   400
  109.          Underline       =   0   'False
  110.          Italic          =   0   'False
  111.          Strikethrough   =   0   'False
  112.       EndProperty
  113.       OLEDragMode     =   1
  114.       OLEDropMode     =   1
  115.       NumItems        =   0
  116.    End
  117.    Begin VB.PictureBox picTitles 
  118.       Align           =   1  'Align Top
  119.       Appearance      =   0  'Flat
  120.       BorderStyle     =   0  'None
  121.       BeginProperty Font 
  122.          Name            =   "MS Sans Serif"
  123.          Size            =   8.25
  124.          Charset         =   0
  125.          Weight          =   400
  126.          Underline       =   0   'False
  127.          Italic          =   0   'False
  128.          Strikethrough   =   0   'False
  129.       EndProperty
  130.       ForeColor       =   &H80000008&
  131.       Height          =   300
  132.       Left            =   0
  133.       ScaleHeight     =   300
  134.       ScaleWidth      =   9240
  135.       TabIndex        =   1
  136.       TabStop         =   0   'False
  137.       Top             =   420
  138.       Width           =   9240
  139.       Begin VB.Label lblTitle 
  140.          BorderStyle     =   1  'Fixed Single
  141.          Caption         =   "百利/ERP5.0"
  142.          Height          =   270
  143.          Index           =   0
  144.          Left            =   0
  145.          TabIndex        =   3
  146.          Tag             =   " 树形视图:"
  147.          Top             =   12
  148.          Width           =   2016
  149.       End
  150.       Begin VB.Label lblTitle 
  151.          BorderStyle     =   1  'Fixed Single
  152.          Caption         =   " 列表视图:"
  153.          Height          =   270
  154.          Index           =   1
  155.          Left            =   2078
  156.          TabIndex        =   2
  157.          Tag             =   " 列表视图:"
  158.          Top             =   12
  159.          Width           =   3216
  160.       End
  161.    End
  162.    Begin MSComDlg.CommonDialog dlgCommonDialog 
  163.       Left            =   5460
  164.       Top             =   1380
  165.       _ExtentX        =   847
  166.       _ExtentY        =   847
  167.       _Version        =   393216
  168.    End
  169.    Begin MSComctlLib.TreeView tvTreeView 
  170.       Height          =   4800
  171.       Left            =   60
  172.       TabIndex        =   4
  173.       Top             =   690
  174.       Width           =   2010
  175.       _ExtentX        =   3545
  176.       _ExtentY        =   8467
  177.       _Version        =   393217
  178.       Indentation     =   564
  179.       LabelEdit       =   1
  180.       Style           =   7
  181.       ImageList       =   "ImageList1"
  182.       Appearance      =   1
  183.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  184.          Name            =   "宋体"
  185.          Size            =   9
  186.          Charset         =   134
  187.          Weight          =   400
  188.          Underline       =   0   'False
  189.          Italic          =   0   'False
  190.          Strikethrough   =   0   'False
  191.       EndProperty
  192.    End
  193.    Begin MSComctlLib.Toolbar tbToolBar 
  194.       Align           =   1  'Align Top
  195.       Height          =   420
  196.       Left            =   0
  197.       TabIndex        =   6
  198.       Top             =   0
  199.       Width           =   9240
  200.       _ExtentX        =   16298
  201.       _ExtentY        =   741
  202.       ButtonWidth     =   609
  203.       ButtonHeight    =   582
  204.       AllowCustomize  =   0   'False
  205.       Appearance      =   1
  206.       ImageList       =   "imlToolbarIcons"
  207.       _Version        =   393216
  208.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  209.          NumButtons      =   10
  210.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  211.             Style           =   3
  212.          EndProperty
  213.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  214.             Key             =   "返回"
  215.             Object.ToolTipText     =   "返回"
  216.             ImageKey        =   "xq"
  217.          EndProperty
  218.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  219.             Key             =   "向前"
  220.             Object.ToolTipText     =   "向前"
  221.             ImageKey        =   "xh"
  222.          EndProperty
  223.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  224.             Style           =   3
  225.          EndProperty
  226.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  227.             Style           =   3
  228.          EndProperty
  229.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  230.             Style           =   3
  231.          EndProperty
  232.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  233.             Key             =   "大图标"
  234.             Object.ToolTipText     =   "大图标"
  235.             ImageKey        =   "dtb"
  236.             Style           =   2
  237.             Value           =   1
  238.          EndProperty
  239.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  240.             Key             =   "小图标"
  241.             Object.ToolTipText     =   "小图标"
  242.             ImageKey        =   "xtb"
  243.             Style           =   2
  244.          EndProperty
  245.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  246.             Key             =   "列表"
  247.             Object.ToolTipText     =   "列表"
  248.             ImageKey        =   "lb"
  249.             Style           =   2
  250.          EndProperty
  251.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  252.             Key             =   "详细资料"
  253.             Object.ToolTipText     =   "详细资料"
  254.             ImageKey        =   "xxzl"
  255.             Style           =   2
  256.          EndProperty
  257.       EndProperty
  258.    End
  259.    Begin MSComctlLib.ImageList imlToolbarIcons 
  260.       Left            =   4710
  261.       Top             =   840
  262.       _ExtentX        =   1005
  263.       _ExtentY        =   1005
  264.       BackColor       =   -2147483643
  265.       ImageWidth      =   16
  266.       ImageHeight     =   16
  267.       MaskColor       =   12632256
  268.       _Version        =   393216
  269.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  270.          NumListImages   =   6
  271.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  272.             Picture         =   "系统_主操作桌面.frx":5598
  273.             Key             =   "xq"
  274.          EndProperty
  275.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  276.             Picture         =   "系统_主操作桌面.frx":5932
  277.             Key             =   "xh"
  278.          EndProperty
  279.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  280.             Picture         =   "系统_主操作桌面.frx":5CCC
  281.             Key             =   "dtb"
  282.          EndProperty
  283.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  284.             Picture         =   "系统_主操作桌面.frx":6066
  285.             Key             =   "xtb"
  286.          EndProperty
  287.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  288.             Picture         =   "系统_主操作桌面.frx":6400
  289.             Key             =   "lb"
  290.          EndProperty
  291.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  292.             Picture         =   "系统_主操作桌面.frx":679A
  293.             Key             =   "xxzl"
  294.          EndProperty
  295.       EndProperty
  296.    End
  297.    Begin MSComctlLib.ImageList ImageList2 
  298.       Left            =   6210
  299.       Top             =   2370
  300.       _ExtentX        =   1005
  301.       _ExtentY        =   1005
  302.       BackColor       =   -2147483643
  303.       ImageWidth      =   32
  304.       ImageHeight     =   32
  305.       MaskColor       =   12632256
  306.       _Version        =   393216
  307.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  308.          NumListImages   =   4
  309.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  310.             Picture         =   "系统_主操作桌面.frx":6B34
  311.             Key             =   "y1"
  312.          EndProperty
  313.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  314.             Picture         =   "系统_主操作桌面.frx":6F88
  315.             Key             =   ""
  316.          EndProperty
  317.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  318.             Picture         =   "系统_主操作桌面.frx":72A8
  319.             Key             =   "i"
  320.          EndProperty
  321.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  322.             Picture         =   "系统_主操作桌面.frx":82FA
  323.             Key             =   "y"
  324.          EndProperty
  325.       EndProperty
  326.    End
  327.    Begin VB.Image imgSplitter 
  328.       Height          =   4785
  329.       Left            =   4230
  330.       MousePointer    =   9  'Size W E
  331.       Top             =   750
  332.       Width           =   150
  333.    End
  334. End
  335. Attribute VB_Name = "Xt_Control"
  336. Attribute VB_GlobalNameSpace = False
  337. Attribute VB_Creatable = False
  338. Attribute VB_PredeclaredId = True
  339. Attribute VB_Exposed = False
  340. '***********************************************
  341. '*    模 块 名 称 :系统主操作桌面
  342. '*    功 能 描 述 :
  343. '*    程序员姓名  :张建忠
  344. '*    最后修改人  :张建忠
  345. '*    最后修改时间:2001/06/21
  346. '*    备        注:封版
  347. '***********************************************
  348. Const NAME_COLUMN = 0
  349. Const TYPE_COLUMN = 1
  350. Const SIZE_COLUMN = 2
  351. Const DATE_COLUMN = 3
  352. Private Declare Function OSWinHelp% Lib "user32" Alias "WinHelpA" (ByVal hwnd&, ByVal HelpFile$, ByVal wCommand%, dwData As Any)
  353.   
  354. Dim mbMoving As Boolean
  355. Const sglSplitLimit = 1000
  356. Dim nodX As Node
  357. Dim mitem As ListItem
  358. Dim Ztxxrec As New ADODB.Recordset           '帐套信息动态集
  359. Dim Xtgnbrec As New ADODB.Recordset          '系统功能表
  360. Dim Xtqxxzrec As New ADODB.Recordset         '系统权限限制动态集
  361. Dim Tsxx As String                           '系统提示信息
  362. Dim gnsyte As String                         '系统功能项索引
  363. Dim Xtrlrec As New ADODB.Recordset           '系统日历动态集
  364. Dim Ctsfscdr As Boolean                      '窗体是否首次读入
  365. Dim sjgnbmStr As String
  366. Private Sub lvListView_DblClick()            '点击ListView执行相应功能
  367.     
  368.     If lvListView.ListItems.Count > 0 Then
  369.         Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where gnbm='" + Mid(Trim(lvListView.SelectedItem.Key), 2, Len(Trim(lvListView.SelectedItem.Key)) - 1) + "'")
  370.         If Not Xtgnbrec.EOF Then
  371.             If Xtgnbrec!mjbz <> True Then                              '不是末级,继续展开
  372.                 Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where sjgnbm='" + Mid(Trim(lvListView.SelectedItem.Key), 2, Len(Trim(lvListView.SelectedItem.Key)) - 1) + "'")
  373.                 If Not Xtgnbrec.EOF Then
  374.                     lvListView.ColumnHeaders.Clear
  375.                     lvListView.ListItems.Clear
  376.                     lvListView.ColumnHeaders.Add 1, "rcsw", tvTreeView.SelectedItem.Text, 3000, , "stb"
  377.                     Xtgnbrec.MoveLast: Xtgnbrec.MoveFirst
  378.                     Do While Not Xtgnbrec.EOF
  379.                         
  380.                         Set mitem = lvListView.ListItems.Add()
  381.                         mitem.Text = Trim(Xtgnbrec!gnmc)
  382.                      
  383.                         If Xtgnbrec.Fields("mjbz") Then
  384.                             mitem.SmallIcon = "gnqx"
  385.                             mitem.Icon = "y"
  386.                         Else
  387.                             mitem.Icon = "i"
  388.                             mitem.SmallIcon = "stb"
  389.                         End If
  390.                      
  391.                         mitem.Key = "T" & Trim(Xtgnbrec!gnbm)
  392.                         Xtgnbrec.MoveNext
  393.                     Loop
  394.                 End If
  395.             Else                                                    '是末级,执行功能
  396.                 gnsyte = Trim(Xtgnbrec.Fields("gnsy"))
  397.                 Call Zxxymk(gnsyte)
  398.             End If
  399.         End If
  400.     End If
  401. End Sub
  402. Private Sub lvListView_KeyPress(KeyAscii As Integer)
  403.     If KeyAscii = vbKeyReturn Then
  404.         Call lvListView_DblClick
  405.     End If
  406. End Sub
  407. Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
  408.     Dim Ssql As String
  409.     If Node.Tag <> "" Then
  410.         If Node.Tag = False Then
  411.             Ssql = "SELECT * FROM xt_xtgnb where sjgnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "' and MenuList=1 order by gnbm"
  412.             If sjgnbmStr = Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) Then
  413.                 Exit Sub
  414.             Else
  415.                 sjgnbmStr = Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1)
  416.             End If
  417.         Else
  418.             Ssql = "SELECT * FROM xt_xtgnb a," _
  419.                     & "(SELECT sjgnbm FROM xt_xtgnb where gnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "')b" & " where a.sjgnbm=b.sjgnbm and MenuList=1 order by gnbm"
  420.         End If
  421.         
  422.         Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute(Ssql)
  423.         If Node.Tag = True Then
  424.             If sjgnbmStr = Trim(Xtgnbrec!sjgnbm) Then
  425.                 Exit Sub
  426.             Else
  427.                 sjgnbmStr = Trim(Xtgnbrec!sjgnbm)
  428.             End If
  429.         End If
  430.         lvListView.ColumnHeaders.Clear
  431.         lvListView.ListItems.Clear
  432.         lvListView.ColumnHeaders.Add 1, "rcsw", "明细", 3000, , "stb"
  433.         Do While Not Xtgnbrec.EOF
  434.             Set mitem = lvListView.ListItems.Add()
  435.             mitem.Text = Trim(Xtgnbrec!gnmc)
  436.             If Xtgnbrec.Fields("mjbz") Then
  437.                 mitem.SmallIcon = "gnqx"
  438.                 mitem.Icon = "y"
  439.             Else
  440.                 mitem.Icon = "i"
  441.                 mitem.SmallIcon = "stb"
  442.             End If
  443.             mitem.Key = "T" & Trim(Xtgnbrec!gnbm)
  444.             Xtgnbrec.MoveNext
  445.         Loop
  446.     End If
  447. End Sub
  448. Public Sub Cshgns()                                                    '初始化系统功能树
  449.   
  450.     Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where gnbm like '24%' and MenuList=1 order by gnbm")
  451.     tvTreeView.Nodes.Add , 4, "T", "百利/ERP5.0", "xttb"
  452.     With Xtgnbrec
  453.         Do While Not .EOF
  454.             If .Fields("mjbz") Then
  455.                 Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "gnqx")
  456.             Else
  457.                 If Trim(.Fields("sjgnbm")) = "" Then
  458.                     Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "kpgl")
  459.                 Else
  460.                     Set nodX = tvTreeView.Nodes.Add("T" + Trim(.Fields("sjgnbm")), 4, "T" + Trim(.Fields("gnbm")), Trim(.Fields("gnmc")), "stb")
  461.                 End If
  462.             End If
  463.             nodX.Tag = Xtgnbrec!mjbz
  464.             If Len(Trim(.Fields("sjgnbm"))) <= 2 Then
  465.                 nodX.EnsureVisible
  466.             End If
  467.             .MoveNext
  468.         Loop
  469.     End With
  470. End Sub
  471. '系统功能树操作
  472. Private Sub tvTreeView_BeforeLabelEdit(Cancel As Integer)                     '屏蔽编辑
  473.   Cancel = 1
  474. End Sub
  475. Private Sub tvTreeView_Collapse(ByVal Node As MSComctlLib.Node)               '功能树收缩
  476.     
  477.     If Node.Index <> 1 And Node.Key <> "T24" Then
  478.         Node.Image = "stb"
  479.     End If
  480.  
  481. End Sub
  482. Private Sub tvTreeView_Expand(ByVal Node As MSComctlLib.Node)                 '功能树展开
  483.     
  484.     If Node.Index <> 1 And Node.Key <> "T24" Then
  485.         Node.Image = "szk"
  486.     End If
  487. End Sub
  488. Private Sub tvTreeView_KeyPress(KeyAscii As Integer)                          '用户按回车键执行相应功能
  489.     
  490.     If KeyAscii = vbKeyReturn Then
  491.         Call tvTreeView_DblClick
  492.     End If
  493. End Sub
  494. Private Sub tvTreeView_DblClick()                                             '选择功能
  495.     
  496.     If tvTreeView.SelectedItem.Children = 0 Then
  497.         Set Xtgnbrec = Cw_DataEnvi.DataConnect.Execute("SELECT * FROM xt_xtgnb where gnbm='" + Mid(Trim(tvTreeView.SelectedItem.Key), 2, Len(Trim(tvTreeView.SelectedItem.Key)) - 1) + "'")
  498.         If Not Xtgnbrec.EOF Then
  499.             gnsyte = Trim(Xtgnbrec.Fields("gnsy"))
  500.             Call Zxxymk(gnsyte)
  501.         End If
  502.     End If
  503. End Sub
  504. Public Sub Zxxymk(gnsy As String)                                            '根据用户选择执行相应程序
  505.   
  506.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  507.     Dim Sqlstr As String                   '临时查询字符串
  508.   
  509.     If Len(Trim(gnsy)) = 0 Then
  510.         Exit Sub
  511.     End If
  512.     
  513. '    '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  514. '    If Not Security_Log(gnsy, Xtczybm, 1, True) Then
  515. '        Exit Sub
  516. '    End If
  517.     
  518.     On Error GoTo Cwcl:
  519.     Select Case gnsy
  520.         '文件
  521.         Case "MRP_ReLogin"                       '用户重新注册
  522.             XT_login.Show 1
  523.         Case "MRP_Quit"
  524.             Unload XT_Main
  525.             '模式程序
  526.             '1.录入类型
  527.             Case "MRP_DemandType"                   '需求类型
  528.                 If Not Security_Log("MRP_DemandType", Xtczybm, 1) Then
  529.                     Exit Sub
  530.                 End If
  531.                 Base_DemandType.HelpContextID = 2411001
  532.                 Base_DemandType.Show 1
  533.                 Security_Log "MRP_DemandType", Xtczybm, 2, False  '用户退出时写上机日志
  534.                 
  535.             Case "MRP_DeptLimit"                    '部门权限
  536.                 If Not Security_Log("MRP_DeptLimit ", Xtczybm, 1) Then
  537.                     Exit Sub
  538.                 End If
  539.                 Base_DeptAdmin.HelpContextID = 2411002
  540.                 Base_DeptAdmin.Show 1
  541.                 Security_Log "MRP_DeptLimit", Xtczybm, 2, False  '用户退出时写上机日志
  542.             
  543.             Case "MRP_BOMMaintenance"               '配方维护
  544.                 If Not Security_Log("MRP_BOMMaintenance_Edit", Xtczybm, 1) Then
  545.                     Exit Sub
  546.                 End If
  547.                 Xtcdcs = "1"
  548.                 BOM_BOMDefine.HelpContextID = 2412001
  549.                 BOM_BOMDefine.Show 1
  550.                 Security_Log "MRP_DeptLimit", Xtczybm, 2, False  '用户退出时写上机日志
  551.                 
  552.             Case "MRP_BOMList"                      '产品配方查询
  553.                 If Not Security_Log("MRP_BOMList", Xtczybm, 1) Then
  554.                     Exit Sub
  555.                 End If
  556.                 BOM_QueryList.HelpContextID = 2412002
  557.                 BOM_QueryList.Show
  558.                 BOM_Query.HelpContextID = 2412002
  559.                 BOM_Query.Show 1
  560.                 
  561.             Case "MRP_BOMCost"                      '产品配方成本
  562.                 If Not Security_Log("MRP_BOMCost", Xtczybm, 1) Then
  563.                     Exit Sub
  564.                 End If
  565.                 BOM_BOMCostList.HelpContextID = 2412003
  566.                 BOM_BOMCostList.Show
  567.                 BOM_BOMCostQuery.HelpContextID = 2412003
  568.                 BOM_BOMCostQuery.Show 1
  569.                 
  570.             Case "MRP_MPSMaintenance"               '主生产计划录入
  571.                 If Not Security_Log("MRP_MPSMaintenance_Edit", Xtczybm, 1) Then
  572.                     Exit Sub
  573.                 End If
  574.                 Xtcdcs = "1"
  575.                 MPS_PlanBuild.HelpContextID = 2413001
  576.                 MPS_PlanBuild.Show 1
  577.                 Security_Log "MRP_MPSMaintenance_Edit", Xtczybm, 2, False  '用户退出时写上机日志
  578.                 
  579.             Case "MRP_MPSList"                      '主生产计划列表
  580.                 If Not Security_Log("MRP_MPSList", Xtczybm, 1) Then
  581.                     Exit Sub
  582.                 End If
  583.                 MPS_List.HelpContextID = 2413002
  584.                 MPS_List.Show
  585.                 MPS_Query.HelpContextID = 2413002
  586.                 MPS_Query.Show 1
  587.                 
  588.             Case "MRP_CreateDependentDemand"        '相关需求生成
  589.                 If Not Security_Log("MRP_CreateDependentDemand", Xtczybm, 1) Then
  590.                     Exit Sub
  591.                 End If
  592.                 MRP_DependentDemandBuild.HelpContextID = 241400101
  593.                 MRP_DependentDemandBuild.Show 1
  594.                 Security_Log "MRP_CreateDependentDemand", Xtczybm, 2, False  '用户退出时写上机日志
  595.                 
  596.             Case "MRP_DependentDemandList"          '相关需求列表
  597.                 If Not Security_Log("MRP_DependentDemandList", Xtczybm, 1) Then
  598.                     Exit Sub
  599.                 End If
  600.                 MRP_DependentDemandList.HelpContextID = 241400102
  601.                 MRP_DependentDemandList.Show
  602.                 MRP_DependentDemandQuery.HelpContextID = 241400102
  603.                 MRP_DependentDemandQuery.Show 1
  604.                 
  605.             Case "MRP_IndependentMaintenance"       '独立需求录入
  606.                 If Not Security_Log("MRP_IndependentMain_Edit", Xtczybm, 1) Then
  607.                     Exit Sub
  608.                 End If
  609.                 Xtcdcs = "1"
  610.                 MRP_IndependentDemand.HelpContextID = 241400201
  611.                 MRP_IndependentDemand.Show 1
  612.                 Security_Log "MRP_IndependentMain_Edit", Xtczybm, 2, False  '用户退出时写上机日志
  613.             
  614.             Case "MRP_IndependentList"              '独立需求列表
  615.                 If Not Security_Log("MRP_IndependentList", Xtczybm, 1) Then
  616.                     Exit Sub
  617.                 End If
  618.                 MRP_IndependentDemandList.HelpContextID = 241400202
  619.                 MRP_IndependentDemandList.Show
  620.                 MRP_IndependentDemandQuery.HelpContextID = 241400202
  621.                 MRP_IndependentDemandQuery.Show 1
  622.                 
  623.             Case "MRP_SumTotal"                     '汇总物料需求汇总需求
  624.                 If Not Security_Log("MRP_SumTotal", Xtczybm, 1) Then
  625.                     Exit Sub
  626.                 End If
  627.                 MRP_TotalDemandBuild.HelpContextID = 241400301
  628.                 MRP_TotalDemandBuild.Show 1
  629.                 Security_Log "MRP_SumTotal", Xtczybm, 2, False  '用户退出时写上机日志
  630.                 
  631.             Case "MRP_SumList"                      '汇总物料需求列表
  632.                 If Not Security_Log("MRP_SumList", Xtczybm, 1) Then
  633.                     Exit Sub
  634.                 End If
  635.                 MRP_TotalDemandList.HelpContextID = 241400302
  636.                 MRP_TotalDemandList.Show
  637.                 MRP_TotalDemandQuery.HelpContextID = 241400302
  638.                 MRP_TotalDemandQuery.Show 1
  639.                 
  640.             Case "MRP_ProductDataReport"            '产品产量日报表
  641.                 If Not Security_Log("MRP_ProductDataReport_Edit", Xtczybm, 1) Then
  642.                     Exit Sub
  643.                 End If
  644.                 Xtcdcs = 1
  645.                 SFC_OutputNote.HelpContextID = 2415001
  646.                 SFC_OutputNote.Show 1
  647.                 Security_Log "MRP_ProductDataReport_Edit", Xtczybm, 2, False  '用户退出时写上机日志
  648.                 
  649.             Case "MPR_ConsumeDataReport"            '物料消耗日报表
  650.                 If Not Security_Log("MPR_ConsumeDataReport_Edit", Xtczybm, 1) Then
  651.                     Exit Sub
  652.                 End If
  653.                 Xtcdcs = 1
  654.                 SFC_ExpendNote.HelpContextID = 2415002
  655.                 SFC_ExpendNote.Show 1
  656.                 Security_Log "MPR_ConsumeDataReport_Edit", Xtczybm, 2, False  '用户退出时写上机日志
  657.                 
  658.             Case "MRP_ProductReportList"            '产品产量列表
  659.                 If Not Security_Log("MRP_ProductReportList", Xtczybm, 1) Then
  660.                     Exit Sub
  661.                 End If
  662.                 SFC_OutputList.HelpContextID = 2415003
  663.                 SFC_OutputList.Show
  664.                 SFC_OutputQuery.HelpContextID = 2415003
  665.                 SFC_OutputQuery.Show 1
  666.                 
  667.             Case "MRP_ConsumeReportList"            '物料消耗列表
  668.                 If Not Security_Log("MRP_ConsumeReportList", Xtczybm, 1) Then
  669.                     Exit Sub
  670.                 End If
  671.                 SFC_ExpendList.HelpContextID = 2415004
  672.                 SFC_ExpendList.Show
  673.                 SFC_ExpendQuery.HelpContextID = 2415004
  674.                 SFC_ExpendQuery.Show 1
  675.                 
  676.             Case "MRP_ProduceDataReport"            '生产日报
  677.                 If Not Security_Log("MRP_ProduceDataReport", Xtczybm, 1) Then
  678.                     Exit Sub
  679.                 End If
  680.                 SFC_ProDailyList.HelpContextID = 2415005
  681.                 SFC_ProDailyList.Show
  682.                 SFC_ProDailyQuery.HelpContextID = 2415005
  683.                 SFC_ProDailyQuery.Show 1
  684.                 
  685.             Case "MRP_StockBuild"                   '生成采购计划
  686.                 If Not Security_Log("MRP_StockBuild", Xtczybm, 1) Then
  687.                     Exit Sub
  688.                 End If
  689.                 Stock_PlanBuild.HelpContextID = 2416001
  690.                 Stock_PlanBuild.Show 1
  691.                 Security_Log "MRP_StockBuild", Xtczybm, 2, False  '用户退出时写上机日志
  692.                 
  693.             Case "MRP_PurchaseList"                 '采购计划列表
  694.                 If Not Security_Log("MRP_PurchaseList", Xtczybm, 1) Then
  695.                     Exit Sub
  696.                 End If
  697.                 Stock_PlanList.HelpContextID = 2416002
  698.                 Stock_PlanList.Show
  699.                 Stock_PlanQuery.HelpContextID = 2416002
  700.                 Stock_PlanQuery.Show 1
  701.                 
  702.             Case "MRP_KfCreate"                     '生成库房领料单
  703.                 If Not Security_Log("MRP_KfCreate ", Xtczybm, 1) Then
  704.                     Exit Sub
  705.                 End If
  706.                 Kf_Create.HelpContextID = 2416006
  707.                 Kf_Create.Show 1
  708.                 Security_Log "MRP_KfCreate", Xtczybm, 2, False  '用户退出时写上机日志
  709.                 
  710.             Case "MRP_KfIssueList"                  '领料单列表
  711.                 If Not Security_Log("MRP_KfIssueList ", Xtczybm, 1) Then
  712.                     Exit Sub
  713.                 End If
  714.                 Kf_IssueList.HelpContextID = 2416004
  715.                 Kf_IssueList.Show
  716.                 Kf_IssueQuery.HelpContextID = 2416004
  717.                 Kf_IssueQuery.Show 1
  718.                 
  719.             Case "MRP_PlanStatReport"               '计划执行情况
  720.                 If Not Security_Log("MRP_PlanStatReport ", Xtczybm, 1) Then
  721.                     Exit Sub
  722.                 End If
  723.                 Report_PlanExecList.HelpContextID = 2417001
  724.                 Report_PlanExecList.Show
  725.                 Report_PlanExecQuery.HelpContextID = 2417001
  726.                 Report_PlanExecQuery.Show 1
  727.                 
  728.             Case "MRP_ConsumeStat"                  '物料消耗统计
  729.                 If Not Security_Log("MRP_ConsumeStat ", Xtczybm, 1) Then
  730.                     Exit Sub
  731.                 End If
  732.                 Report_MaterExpendList.HelpContextID = 2417002
  733.                 Report_MaterExpendList.Show
  734.                 Report_MaterExpendQuery.HelpContextID = 2417002
  735.                 Report_MaterExpendQuery.Show 1
  736.                 
  737.             Case "MRP_MaterialPlan"                 '领料计划
  738.                 If Not Security_Log("MRP_MaterialPlan ", Xtczybm, 1) Then
  739.                     Exit Sub
  740.                 End If
  741.                 Report_SendMaterCircs.HelpContextID = 2417003
  742.                 Report_SendMaterCircs.Show
  743.                 Report_SendMaterCircsQuery.HelpContextID = 2417003
  744.                 Report_SendMaterCircsQuery.Show 1
  745.                 
  746.             Case "MRP_Internet"                         '网上华夏新达
  747.                 ShellExecute 0, "open", "www.hxxd.com", "", "", 0
  748.                 
  749.             Case "MRP_Help"                           '系统帮助
  750.                 Call F1bz
  751.                 
  752.             Case "MRP_About"                             '关于
  753.                 XT_frmAbout.Show
  754.                 
  755.     End Select
  756.     
  757.     '用户退出时写上机日志
  758.    Security_Log gnsy, Xtczybm, 2, False
  759.    
  760.     Exit Sub
  761. Cwcl:
  762.     Tsxx = "此项系统功能有待完善!"
  763.     Call Xtxxts(Tsxx, 0, 4)
  764.     Exit Sub
  765. End Sub
  766. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)        '用户关闭窗体
  767.   
  768.     If Unload_TF = False Then
  769.         Cancel = 1
  770.         Me.WindowState = 1
  771.     End If
  772. End Sub
  773. Private Sub Form_Load()
  774.     
  775.     '设置窗体图标
  776.     Me.Icon = XT_Main.Icon
  777.     
  778.     '设置窗体位置大小,并调入系统功能树
  779.     Me.Left = 0
  780.     Me.Top = 0
  781.     Me.Width = XT_Main.Width - 60
  782.     Me.Height = XT_Main.Height - 760 - 690
  783.     Call Cshgns
  784.     
  785.     '启动调入数据等待提示
  786.     Load Xt_Wait
  787.     
  788. End Sub
  789. Private Sub Form_Unload(Cancel As Integer)
  790.     
  791.     On Error Resume Next
  792.     
  793.     Dim i As Integer
  794.     For i = Forms.Count - 1 To 1 Step -1
  795.         Unload Forms(i)
  796.     Next
  797.     If Me.WindowState <> vbMinimized Then
  798.         SaveSetting App.Title, "Settings", "MainLeft", Me.Left
  799.         SaveSetting App.Title, "Settings", "MainTop", Me.Top
  800.         SaveSetting App.Title, "Settings", "MainWidth", Me.Width
  801.         SaveSetting App.Title, "Settings", "MainHeight", Me.Height
  802.     End If
  803.     SaveSetting App.Title, "Settings", "ViewMode", lvListView.View
  804. End Sub
  805. Private Sub Form_Resize()
  806.     
  807.     On Error Resume Next
  808.     If Me.Width < 3000 Then Me.Width = 3000
  809.     SizeControls imgSplitter.Left
  810. End Sub
  811. Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  812.     
  813.     With imgSplitter
  814.         picSplitter.Move .Left, .Top, .Width  2, .Height - 20
  815.     End With
  816.     picSplitter.Visible = True
  817.     mbMoving = True
  818. End Sub
  819. Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  820.     
  821.     Dim sglPos As Single
  822.     If mbMoving Then
  823.         sglPos = X + imgSplitter.Left
  824.         If sglPos < sglSplitLimit Then
  825.             picSplitter.Left = sglSplitLimit
  826.         ElseIf sglPos > Me.Width - sglSplitLimit Then
  827.             picSplitter.Left = Me.Width - sglSplitLimit
  828.         Else
  829.             picSplitter.Left = sglPos
  830.         End If
  831.     End If
  832. End Sub
  833. Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  834.     
  835.     SizeControls picSplitter.Left
  836.     picSplitter.Visible = False
  837.     mbMoving = False
  838.     lvListView.Refresh
  839. End Sub
  840. Private Sub TreeView1_DragDrop(Source As Control, X As Single, Y As Single)
  841.     
  842.     If Source = imgSplitter Then
  843.         SizeControls X
  844.     End If
  845. End Sub
  846. Sub SizeControls(X As Single)
  847.     
  848.     On Error Resume Next
  849.     '设置 Width 属性
  850.     If X < 3500 Then X = 3500
  851.     If X > (Me.Width - 1500) Then X = Me.Width - 1500
  852.     tvTreeView.Width = X
  853.     imgSplitter.Left = X
  854.     lvListView.Left = X + 40
  855.     lvListView.Width = Me.Width - (tvTreeView.Width + 140)
  856.     lblTitle(0).Width = tvTreeView.Width
  857.     lblTitle(1).Left = lvListView.Left + 20
  858.     lblTitle(1).Width = lvListView.Width - 40
  859.     '设置 Top 属性
  860.     tvTreeView.Top = tbToolBar.Height + picTitles.Height
  861.     lvListView.Top = tvTreeView.Top
  862.     '设置 height 属性
  863.     tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height)
  864.     
  865.     lvListView.Height = tvTreeView.Height
  866.     imgSplitter.Top = tvTreeView.Top
  867.     imgSplitter.Height = tvTreeView.Height
  868. End Sub
  869. Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button)
  870.     
  871.     On Error Resume Next
  872.     
  873.     Select Case Button.Key
  874.         Case "返回"
  875.             tvTreeView.SetFocus
  876.               SendKeys "{up}", True
  877.         Case "向前"
  878.              tvTreeView.SetFocus
  879.               SendKeys "{DOWN}", True
  880.         Case "大图标"
  881.             lvListView.View = lvwIcon
  882.         Case "小图标"
  883.             lvListView.View = lvwSmallIcon
  884.         Case "列表"
  885.             lvListView.View = lvwList
  886.         Case "详细资料"
  887.             lvListView.View = lvwReport
  888.     End Select
  889. End Sub