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

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  4. Begin VB.Form Dev_AmplidyneForm 
  5.    BackColor       =   &H00C0C0C0&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "设备附属电机"
  8.    ClientHeight    =   6990
  9.    ClientLeft      =   675
  10.    ClientTop       =   720
  11.    ClientWidth     =   11400
  12.    HelpContextID   =   2503001
  13.    Icon            =   "设备档案_附属电机.frx":0000
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form4"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   6990
  19.    ScaleWidth      =   11400
  20.    StartUpPosition =   1  '所有者中心
  21.    Begin VB.CommandButton Ydcommand 
  22.       Height          =   300
  23.       Left            =   11010
  24.       Picture         =   "设备档案_附属电机.frx":1042
  25.       Style           =   1  'Graphical
  26.       TabIndex        =   1
  27.       TabStop         =   0   'False
  28.       Top             =   2010
  29.       Visible         =   0   'False
  30.       Width           =   300
  31.    End
  32.    Begin VB.PictureBox Pic_Title 
  33.       BackColor       =   &H00FFFFFF&
  34.       Height          =   1395
  35.       Left            =   0
  36.       Picture         =   "设备档案_附属电机.frx":13CC
  37.       ScaleHeight     =   1335
  38.       ScaleWidth      =   11715
  39.       TabIndex        =   7
  40.       Top             =   570
  41.       Width           =   11775
  42.       Begin MSComctlLib.ImageList ImageList1 
  43.          Left            =   4260
  44.          Top             =   60
  45.          _ExtentX        =   1005
  46.          _ExtentY        =   1005
  47.          BackColor       =   -2147483643
  48.          ImageWidth      =   16
  49.          ImageHeight     =   16
  50.          MaskColor       =   12632256
  51.          _Version        =   393216
  52.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  53.             NumListImages   =   25
  54.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  55.                Picture         =   "设备档案_附属电机.frx":1E30C
  56.                Key             =   "sz"
  57.             EndProperty
  58.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  59.                Picture         =   "设备档案_附属电机.frx":1E6A6
  60.                Key             =   "dy"
  61.             EndProperty
  62.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  63.                Picture         =   "设备档案_附属电机.frx":1EA40
  64.                Key             =   "yl"
  65.             EndProperty
  66.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  67.                Picture         =   "设备档案_附属电机.frx":1EDDA
  68.                Key             =   "xg"
  69.             EndProperty
  70.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  71.                Picture         =   "设备档案_附属电机.frx":1F174
  72.                Key             =   "zh"
  73.             EndProperty
  74.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  75.                Picture         =   "设备档案_附属电机.frx":1F50E
  76.                Key             =   "sh"
  77.             EndProperty
  78.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  79.                Picture         =   "设备档案_附属电机.frx":1F8A8
  80.                Key             =   "bc"
  81.             EndProperty
  82.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  83.                Picture         =   "设备档案_附属电机.frx":1FC42
  84.                Key             =   "fq"
  85.             EndProperty
  86.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  87.                Picture         =   "设备档案_附属电机.frx":1FFDC
  88.                Key             =   "bz"
  89.             EndProperty
  90.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  91.                Picture         =   "设备档案_附属电机.frx":20376
  92.                Key             =   "tc"
  93.             EndProperty
  94.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  95.                Picture         =   "设备档案_附属电机.frx":20710
  96.                Key             =   "bcgs"
  97.             EndProperty
  98.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  99.                Picture         =   "设备档案_附属电机.frx":20AAA
  100.                Key             =   "mrlk"
  101.             EndProperty
  102.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  103.                Picture         =   "设备档案_附属电机.frx":20E44
  104.                Key             =   "xsxm"
  105.             EndProperty
  106.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  107.                Picture         =   "设备档案_附属电机.frx":211DE
  108.                Key             =   "first"
  109.             EndProperty
  110.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  111.                Picture         =   "设备档案_附属电机.frx":21578
  112.                Key             =   "prev"
  113.             EndProperty
  114.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  115.                Picture         =   "设备档案_附属电机.frx":21912
  116.                Key             =   "next"
  117.             EndProperty
  118.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  119.                Picture         =   "设备档案_附属电机.frx":21CAC
  120.                Key             =   "last"
  121.             EndProperty
  122.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  123.                Picture         =   "设备档案_附属电机.frx":22046
  124.                Key             =   "xx"
  125.             EndProperty
  126.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  127.                Picture         =   "设备档案_附属电机.frx":223E0
  128.                Key             =   "define"
  129.             EndProperty
  130.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  131.                Picture         =   "设备档案_附属电机.frx":2277A
  132.                Key             =   "exec"
  133.             EndProperty
  134.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  135.                Picture         =   "设备档案_附属电机.frx":22B14
  136.                Key             =   "xz"
  137.             EndProperty
  138.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  139.                Picture         =   "设备档案_附属电机.frx":22EAE
  140.                Key             =   "sc"
  141.             EndProperty
  142.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  143.                Picture         =   "设备档案_附属电机.frx":23248
  144.                Key             =   "sx"
  145.             EndProperty
  146.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  147.                Picture         =   "设备档案_附属电机.frx":235E2
  148.                Key             =   "cx"
  149.             EndProperty
  150.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  151.                Picture         =   "设备档案_附属电机.frx":2397C
  152.                Key             =   "zd"
  153.             EndProperty
  154.          EndProperty
  155.       End
  156.       Begin VB.Label Label 
  157.          AutoSize        =   -1  'True
  158.          BackColor       =   &H80000009&
  159.          Height          =   180
  160.          Index           =   3
  161.          Left            =   4650
  162.          TabIndex        =   17
  163.          Top             =   1080
  164.          Width           =   90
  165.       End
  166.       Begin VB.Label Label4 
  167.          AutoSize        =   -1  'True
  168.          BackColor       =   &H80000009&
  169.          Caption         =   "所属部门:"
  170.          Height          =   180
  171.          Left            =   3780
  172.          TabIndex        =   16
  173.          Top             =   1080
  174.          Width           =   810
  175.       End
  176.       Begin VB.Label Label 
  177.          AutoSize        =   -1  'True
  178.          BackColor       =   &H80000009&
  179.          Height          =   180
  180.          Index           =   2
  181.          Left            =   1230
  182.          TabIndex        =   15
  183.          Top             =   1110
  184.          Width           =   90
  185.       End
  186.       Begin VB.Label Label3 
  187.          AutoSize        =   -1  'True
  188.          BackColor       =   &H80000009&
  189.          Caption         =   "规格型号:"
  190.          Height          =   180
  191.          Left            =   360
  192.          TabIndex        =   14
  193.          Top             =   1110
  194.          Width           =   810
  195.       End
  196.       Begin VB.Label Label 
  197.          AutoSize        =   -1  'True
  198.          BackColor       =   &H80000009&
  199.          Height          =   180
  200.          Index           =   1
  201.          Left            =   4650
  202.          TabIndex        =   13
  203.          Top             =   810
  204.          Width           =   90
  205.       End
  206.       Begin VB.Label Label2 
  207.          AutoSize        =   -1  'True
  208.          BackColor       =   &H80000009&
  209.          Caption         =   "设备名称:"
  210.          Height          =   180
  211.          Left            =   3780
  212.          TabIndex        =   12
  213.          Top             =   810
  214.          Width           =   810
  215.       End
  216.       Begin VB.Label Label 
  217.          AutoSize        =   -1  'True
  218.          BackColor       =   &H80000009&
  219.          Height          =   180
  220.          Index           =   0
  221.          Left            =   1230
  222.          TabIndex        =   11
  223.          Top             =   810
  224.          Width           =   90
  225.       End
  226.       Begin VB.Label Label1 
  227.          AutoSize        =   -1  'True
  228.          BackColor       =   &H80000009&
  229.          Caption         =   "设备编号:"
  230.          Height          =   180
  231.          Left            =   360
  232.          TabIndex        =   10
  233.          Top             =   810
  234.          Width           =   810
  235.       End
  236.       Begin VB.Label Lab_TitleText 
  237.          BackStyle       =   0  'Transparent
  238.          ForeColor       =   &H00FF0000&
  239.          Height          =   225
  240.          Left            =   750
  241.          TabIndex        =   9
  242.          Top             =   690
  243.          Width           =   1455
  244.       End
  245.       Begin VB.Label tsLabel 
  246.          BackColor       =   &H80000018&
  247.          BackStyle       =   0  'Transparent
  248.          Caption         =   "设备附属电机"
  249.          BeginProperty Font 
  250.             Name            =   "宋体"
  251.             Size            =   14.25
  252.             Charset         =   134
  253.             Weight          =   700
  254.             Underline       =   0   'False
  255.             Italic          =   0   'False
  256.             Strikethrough   =   0   'False
  257.          EndProperty
  258.          ForeColor       =   &H00000000&
  259.          Height          =   375
  260.          Index           =   4
  261.          Left            =   510
  262.          TabIndex        =   8
  263.          Top             =   180
  264.          Width           =   1965
  265.       End
  266.    End
  267.    Begin VB.TextBox Ydtext 
  268.       BackColor       =   &H00C0FFFF&
  269.       BorderStyle     =   0  'None
  270.       Height          =   330
  271.       Left            =   9300
  272.       MultiLine       =   -1  'True
  273.       TabIndex        =   0
  274.       Top             =   1620
  275.       Visible         =   0   'False
  276.       Width           =   1185
  277.    End
  278.    Begin VB.ComboBox YdCombo 
  279.       Height          =   300
  280.       Left            =   9300
  281.       Style           =   2  'Dropdown List
  282.       TabIndex        =   3
  283.       Top             =   2010
  284.       Visible         =   0   'False
  285.       Width           =   1665
  286.    End
  287.    Begin VB.Timer Timer1 
  288.       Interval        =   1
  289.       Left            =   10530
  290.       Top             =   1560
  291.    End
  292.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  293.       Height          =   5145
  294.       Left            =   0
  295.       TabIndex        =   4
  296.       Top             =   1980
  297.       Width           =   8205
  298.       _ExtentX        =   14473
  299.       _ExtentY        =   9075
  300.       Appearance      =   1
  301.       BorderStyle     =   1
  302.       Enabled         =   -1  'True
  303.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  304.          Name            =   "宋体"
  305.          Size            =   9
  306.          Charset         =   134
  307.          Weight          =   400
  308.          Underline       =   0   'False
  309.          Italic          =   0   'False
  310.          Strikethrough   =   0   'False
  311.       EndProperty
  312.       MousePointer    =   0
  313.       BackColor       =   16777215
  314.       ForeColor       =   -2147483640
  315.       BackColorFixed  =   12632256
  316.       ForeColorFixed  =   -2147483630
  317.       BackColorSel    =   -2147483635
  318.       ForeColorSel    =   -2147483634
  319.       BackColorBkg    =   -2147483636
  320.       BackColorAlternate=   16777215
  321.       GridColor       =   -2147483633
  322.       GridColorFixed  =   -2147483632
  323.       TreeColor       =   -2147483632
  324.       FloodColor      =   192
  325.       SheetBorder     =   -2147483642
  326.       FocusRect       =   1
  327.       HighLight       =   1
  328.       AllowSelection  =   -1  'True
  329.       AllowBigSelection=   -1  'True
  330.       AllowUserResizing=   0
  331.       SelectionMode   =   0
  332.       GridLines       =   1
  333.       GridLinesFixed  =   2
  334.       GridLineWidth   =   1
  335.       Rows            =   50
  336.       Cols            =   10
  337.       FixedRows       =   1
  338.       FixedCols       =   1
  339.       RowHeightMin    =   0
  340.       RowHeightMax    =   0
  341.       ColWidthMin     =   0
  342.       ColWidthMax     =   0
  343.       ExtendLastCol   =   0   'False
  344.       FormatString    =   ""
  345.       ScrollTrack     =   0   'False
  346.       ScrollBars      =   3
  347.       ScrollTips      =   0   'False
  348.       MergeCells      =   0
  349.       MergeCompare    =   0
  350.       AutoResize      =   -1  'True
  351.       AutoSizeMode    =   0
  352.       AutoSearch      =   0
  353.       MultiTotals     =   -1  'True
  354.       SubtotalPosition=   1
  355.       OutlineBar      =   0
  356.       OutlineCol      =   0
  357.       Ellipsis        =   0
  358.       ExplorerBar     =   0
  359.       PicturesOver    =   0   'False
  360.       FillStyle       =   0
  361.       RightToLeft     =   0   'False
  362.       PictureType     =   0
  363.       TabBehavior     =   0
  364.       OwnerDraw       =   0
  365.       Editable        =   0   'False
  366.       ShowComboButton =   -1  'True
  367.       WordWrap        =   0   'False
  368.       TextStyle       =   0
  369.       TextStyleFixed  =   0
  370.       OleDragMode     =   0
  371.       OleDropMode     =   0
  372.       DataMode        =   0
  373.       VirtualData     =   -1  'True
  374.    End
  375.    Begin MSComctlLib.Toolbar Tlb_Action 
  376.       Align           =   1  'Align Top
  377.       Height          =   570
  378.       Left            =   0
  379.       TabIndex        =   2
  380.       Top             =   0
  381.       Width           =   11400
  382.       _ExtentX        =   20108
  383.       _ExtentY        =   1005
  384.       ButtonWidth     =   820
  385.       ButtonHeight    =   953
  386.       AllowCustomize  =   0   'False
  387.       Wrappable       =   0   'False
  388.       Appearance      =   1
  389.       Style           =   1
  390.       ImageList       =   "ImageList1"
  391.       _Version        =   393216
  392.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  393.          NumButtons      =   8
  394.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  395.             Caption         =   "设置"
  396.             Key             =   "ymsz"
  397.             Object.ToolTipText     =   "打印页面设置"
  398.             ImageKey        =   "sz"
  399.          EndProperty
  400.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  401.             Caption         =   "打印"
  402.             Key             =   "dy"
  403.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  404.             ImageKey        =   "dy"
  405.          EndProperty
  406.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  407.             Caption         =   "预览"
  408.             Key             =   "yl"
  409.             ImageKey        =   "yl"
  410.          EndProperty
  411.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  412.             Style           =   3
  413.          EndProperty
  414.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  415.             Caption         =   "删行"
  416.             Key             =   "sh"
  417.             Object.ToolTipText     =   "删除当前记录行或Delete"
  418.             ImageKey        =   "sh"
  419.          EndProperty
  420.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  421.             Style           =   3
  422.          EndProperty
  423.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  424.             Caption         =   "帮助"
  425.             Key             =   "bz"
  426.             ImageKey        =   "bz"
  427.          EndProperty
  428.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  429.             Caption         =   "退出"
  430.             Key             =   "fh"
  431.             ImageKey        =   "tc"
  432.          EndProperty
  433.       EndProperty
  434.       BorderStyle     =   1
  435.       Begin MSComctlLib.Toolbar GsToolbar 
  436.          Height          =   540
  437.          Left            =   9720
  438.          TabIndex        =   6
  439.          Top             =   0
  440.          Width           =   1695
  441.          _ExtentX        =   2990
  442.          _ExtentY        =   953
  443.          ButtonWidth     =   1455
  444.          ButtonHeight    =   953
  445.          AllowCustomize  =   0   'False
  446.          Appearance      =   1
  447.          Style           =   1
  448.          ImageList       =   "ImageList1"
  449.          _Version        =   393216
  450.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  451.             NumButtons      =   2
  452.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  453.                Caption         =   "保存格式"
  454.                Key             =   "bcgs"
  455.                ImageKey        =   "bcgs"
  456.             EndProperty
  457.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  458.                Caption         =   "默认列宽"
  459.                Key             =   "hfmrgs"
  460.                ImageKey        =   "mrlk"
  461.             EndProperty
  462.          EndProperty
  463.       End
  464.    End
  465.    Begin VB.Label Lab_OperStatus 
  466.       BackColor       =   &H000080FF&
  467.       Caption         =   "1"
  468.       Height          =   345
  469.       Left            =   10980
  470.       TabIndex        =   5
  471.       Top             =   1590
  472.       Visible         =   0   'False
  473.       Width           =   345
  474.    End
  475. End
  476. Attribute VB_Name = "Dev_AmplidyneForm"
  477. Attribute VB_GlobalNameSpace = False
  478. Attribute VB_Creatable = False
  479. Attribute VB_PredeclaredId = True
  480. Attribute VB_Exposed = False
  481. '**************************************************************************************************
  482. '*    模 块 名 称 :附属电机(增行式)
  483. '*    功 能 描 述 :
  484. '*    程序员姓名  :王哲
  485. '*    最后修改人  :王哲
  486. '*    最后修改时间:2001/12/16
  487. '*    备        注:程序中所有依实际情况自定义部分均用[>> <<]括起,注意此种录入需要修改"Sub Scdqfl"
  488. '*
  489. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  490. '*
  491. '*    3.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) 1-浏览 2-修改
  492. '**************************************************************************************************
  493.  
  494.  '以下为自定义变量
  495.  
  496.  
  497. '其它固定使用变量
  498. Dim Tsxx As String                              '系统信息提示(Fixed)
  499. Dim ReportTitle As String                       '报表主标题(Fixed)
  500.     
  501. '以下为固定使用变量(网格)
  502. Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  503. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  504. Dim GridCode As String                          '显示网格网格代码
  505. Dim GridInf() As Variant                        '整个网格设置信息
  506. Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  507. Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  508. Dim Sfxshjwg As Boolean                         '是否显示合计网格
  509. Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  510. Dim Sjhgd As Double                             '网格数据行高度
  511. Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  512. Dim GridStr()  As String                        '网格列信息(字符型)
  513. Dim GridInt() As Integer                        '网格列信息(整型)
  514. Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  515. Dim Dqlrwgh As Long                             '当前录入数据网格行
  516. Dim Dqlrwgl As Long                             '当前录入数据网格列
  517. Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  518. Dim Dqlkwgl As Long                             '刚刚离开网格列
  519. Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  520. Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  521. Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  522. Dim Wbkbhlock As Boolean                        '文本框改变值锁
  523. Dim Changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  524. Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  525. Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  526. Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  527. Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  528. Dim Shsfts As Boolean                           '删除记录行是否提示
  529. Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  530.     
  531. Private Sub Form_KeyPress(KeyAscii As Integer)      '控制焦点转移和限制录入字符"'"
  532.     Select Case KeyAscii
  533.         Case 39           '屏蔽字符"'"
  534.             KeyAscii = 0
  535.     End Select
  536.     
  537. End Sub
  538. Private Sub Form_Load()                              '窗 体 装 入
  539.   
  540.     '初始化各种锁值(Fixed)
  541.     Changelock = False             '网格行列改变控制锁
  542.     Gdtlock = False                '滚动条滚动控制
  543.     Yxxpdlock = True               '字段有效性判断锁
  544.     Hyxxpdlock = True              '行有效性判断锁
  545.     Wbkbhlock = False              '文本框内容改变锁
  546.    
  547.     '报表主标题及报表编码(Fixed)
  548.     ReportTitle = "设备附属电机"
  549.     XtReportCode = "Dev_Amplidyne"
  550.     Load Dyymctbl
  551.     '调 入 网 格(Fixed)
  552.     GridCode = "Dev_Amplidyne"      '网格属性编码
  553.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  554.     
  555.     Qslz = GridInf(1)
  556.     Sjhgd = GridInf(2)
  557.     Pmbcsjhs = GridInf(3)
  558.     Fzxwghs = GridInf(4)
  559.     Sfblbzkd = GridInf(5)
  560.     Shsfts = GridInf(6)
  561.     Sfxshjwg = GridInf(7)
  562.     Szzls = WglrGrid.Cols - 1
  563.     
  564.     '设置标题栏宽度、网格宽度高度(Fixed)
  565.     Pic_Title.Move 50, Pic_Title.Top, Me.Width - 150, Pic_Title.Height
  566.     WglrGrid.Move 50, Pic_Title.Top + Pic_Title.Height, Me.Width - 150
  567.     WglrGrid.Height = Me.Height - WglrGrid.Top - 380
  568.       
  569.     '生成查询结果
  570.     Call Sub_Query
  571.     
  572.     '设置状态为修改状态
  573.     Lab_OperStatus = "2"
  574.   
  575. End Sub
  576. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  577.     '调入其它窗体或功能产生的有效性判断(包括数据回写)
  578.     If Not Fun_Drfrmyxxpd Then
  579.        Cancel = True
  580.        Exit Sub
  581.     End If
  582.     '卸载打印页面窗体
  583.     Unload Dyymctbl
  584.    
  585. End Sub
  586. Private Sub Sub_Query()                              '生成查询结果
  587.    
  588.     Dim Sqlstr As String                           '临时使用字符串
  589.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  590.     Dim jsqte As Long                              '临时计数器
  591.     Dim RecMain As New ADODB.Recordset
  592.     
  593.     '禁止网格刷新动作,为加快网格显示速度(Fixed)
  594.     WglrGrid.Redraw = False
  595.     '查询字符串
  596.     Label(0).Caption = StrTemp
  597.     Set RecMain = Cw_DataEnvi.DataConnect.Execute("SELECT Dev_V_MainDepartment.* FROM Dev_V_MainDepartment where DEVID='" & StrTemp & "'")
  598.     If Not RecMain.EOF Then
  599.         Label(1).Caption = RecMain.Fields("Dname")
  600.         Label(2).Caption = RecMain.Fields("Model")
  601.         Label(3).Caption = RecMain.Fields("deptname")
  602.     End If
  603.     
  604.     Sqlstr = "SELECT Dev_Amplidyne.* FROM Dev_Amplidyne where DEVID='" & StrTemp & "'"
  605.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  606.       
  607.     With RecTemp
  608.         WglrGrid.Rows = WglrGrid.FixedRows
  609.         jsqte = WglrGrid.FixedRows
  610.         
  611.         Do While Not .EOF
  612.               
  613.             WglrGrid.AddItem ""
  614.             WglrGrid.TextMatrix(jsqte, 0) = "*"                                                                        '有效记录标识
  615.             WglrGrid.TextMatrix(jsqte, 1) = .Fields("AmplidyneID")                                                     '电机ID
  616.             WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("EmpCode") & "")                  '电机编码
  617.             WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("EmpName") & "")                  '电机名称
  618.             WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("EmpModel") & "")                 '规格型号
  619.             WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("Capacity") & "")                 '容量(千瓦)
  620.             WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("Manufacturer") & "")             '制造厂商
  621.             WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("OurDate") & "")                  '出厂日期
  622.             WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("OutNumber") & "")                '出厂编号
  623.            
  624.             WglrGrid.RowHeight(jsqte) = Sjhgd
  625.             .MoveNext
  626.             jsqte = jsqte + 1
  627.         Loop
  628.     End With
  629.             
  630.     '将网格刷新解禁(Fixed)
  631.     WglrGrid.Redraw = True
  632.     '调整网格(Fixed)
  633.     Call Sub_AdjustGrid
  634.              
  635. End Sub
  636. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  637.      
  638.     '屏蔽文本框,下拉组合框有效性判断
  639.      
  640.     Valilock = True
  641.      
  642.     '屏蔽网格失去焦点产生的有效性判断
  643.      
  644.     Changelock = True
  645.      
  646.     Select Case Button.Key
  647.         Case "ymsz"                                          '页面设置
  648.             Dyymctbl.Show 1
  649.         Case "yl"                                            '预 览
  650.             If Fun_Drfrmyxxpd Then
  651.                 Call bbyl(True)
  652.             End If
  653.         Case "dy"                                            '打 印
  654.             If Fun_Drfrmyxxpd Then
  655.                 Call bbyl(False)
  656.             End If
  657.         Case "sh"                                            '删 行
  658.             Call Scdqfl
  659.         Case "bz"                                            '帮 助
  660.             Call F1bz
  661.         Case "fh"                                            '退 出
  662.             Unload Me
  663.     End Select
  664.        
  665.     '解 锁
  666.     Valilock = False
  667.     Changelock = False
  668.         
  669. End Sub
  670. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  671.     If Shift = 2 Then
  672.         Select Case UCase(Chr(KeyCode))
  673.             Case "P"                   'Ctrl+P 打印
  674.                 If Tlb_Action.Buttons("dy").Enabled Then
  675.                     Call bbyl(False)
  676.                 End If
  677.             End Select
  678.     End If
  679.     
  680. End Sub
  681. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  682.     
  683.     Dim xswbrr As String
  684.     
  685.     With WglrGrid
  686.         Zdlrqnr = Trim(.Text)
  687.         xswbrr = Trim(.Text)
  688.     
  689.         If GridBoolean(.Col, 3) Then   '列表框录入
  690.     
  691.             '填充列表框程序
  692.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  693.         Else
  694.             Wbkbhlock = True
  695.        
  696.             '====以下为用户自定义
  697.             Ydtext.Text = xswbrr
  698.             '====以上为用户自定义
  699.          
  700.             Wbkbhlock = False
  701.             Ydtext.SelStart = Len(Ydtext.Text)
  702.         End If
  703.     End With
  704.     
  705. End Sub
  706. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) As Boolean       '录入数据字段有效性判断,同时进行字段录入事后处理
  707.  '函数参数:Dqpdwgh, Dqpdwgl 当前要判断网格单元所处行列值
  708.     Dim Str_JudgeText As String                 '临时有效性判断字段内容(Fixed)
  709.     Dim Coljsq As Long                          '临时列计数器(Fixed)
  710.     Dim RecTemp As New ADODB.Recordset          '临时使用动态集(Fixed)
  711.     Dim Sqlstr As String                        '临时使用查询字符串(Fixed)
  712.     With WglrGrid
  713.     
  714.         '非录入状态或非数据行则其有效性为合法(Fixed)
  715.         If Yxxpdlock Or .Row < .FixedRows Then
  716.             sjzdyxxpd = True
  717.             Exit Function
  718.         End If
  719.       
  720.         '取得当前要判断字段内容(Fixed)
  721.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  722.       
  723.         '根据不同字段进行相应的处理(依据其逻辑编号)
  724.         Select Case GridStr(Dqpdwgl, 1)
  725.          
  726.             '[>>以下为自定义部分
  727.          
  728.             Case "001"                   '存货编码(字段不为空则做有效性判断及事后处理)
  729.                 
  730.                 For Coljsq = .FixedRows To .Rows - 1
  731.                            If .TextMatrix(Coljsq, 0) = "*" And Coljsq <> Dqpdwgh Then
  732.                               If .TextMatrix(Coljsq, Sydz("001", GridStr(), Szzls)) = _
  733.                                  .TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) Then
  734.                                  pdzwx = True
  735.                                  Tsxx = "编码已经存在重新录入!"
  736.                                  GoTo Lrcwcl
  737.                                  Exit For
  738.                               End If
  739.                            End If
  740.                  Next Coljsq
  741.             Case "006"
  742. '
  743.                 If .TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) <> "" Then
  744.                     If IsDate(Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)))) = 0 Then
  745.                             pdzwx = True
  746.                             Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  747.                             GoTo Lrcwcl
  748.                         
  749.                     End If
  750.                        If Format(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)), "yyyy-mm-dd") < "1930-01-01" Or Format(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)), "yyyy-mm-dd") > Xtrq Then
  751.                             pdzwx = True
  752.                             Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
  753.                             GoTo Lrcwcl
  754.                        End If
  755.                End If
  756.         End Select
  757.         '字段录入正确后为零字段清空(Fixed)
  758.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  759.      
  760.         '字段有效性判断通过,将字段有效性判断加锁直至再次改变(Fixed)
  761.         sjzdyxxpd = True
  762.         Yxxpdlock = True
  763.         Exit Function
  764.     End With
  765.   
  766. Lrcwcl:    '录入错误处理(Fixed)
  767.     With WglrGrid
  768.         '给出错误提示信息
  769.         Call Xtxxts(Tsxx, 0, 1)
  770.       
  771.         '返回网格错误位置(ChangeLock避免再次引发RowColChange有效性判断),装入录入载体
  772.         Changelock = True
  773.         .Select Dqpdwgh, Dqpdwgl
  774.         Changelock = False
  775.         Call xswbk
  776.       
  777.         '函数返回False
  778.         sjzdyxxpd = False
  779.         Exit Function
  780.     End With
  781.     
  782. End Function
  783. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  784.  
  785.     Dim Lrywlz As Long                     '录入错误列值(Fixed)
  786.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  787.     Dim Sqlstr As String                   '临时查询字符串
  788.  
  789.     With WglrGrid
  790.  
  791.         '判断行为空和无效数据行则清除当前行
  792.         If .Rows <= .FixedRows Then Exit Function   ' 如果没有记录,则退出
  793.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  794.             Sjhzyxxpd = True
  795.             Exit Function
  796.         Else
  797.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  798.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  799.                     Changelock = True
  800.                     .RemoveItem Yxxpdh
  801.                     
  802.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  803.                         .AddItem ""
  804.                         .RowHeight(.Rows - 1) = Sjhgd
  805.                     End If
  806.                     
  807.                     Changelock = False
  808.                     Sjhzyxxpd = True
  809.                     Exit Function
  810.                 End If
  811.             End If
  812.         End If
  813.   
  814.         '行没有发生变化则不进行有效性判断
  815.         If Hyxxpdlock Then
  816.             Sjhzyxxpd = True
  817.             Exit Function
  818.         End If
  819.         '以下为自定义部分[
  820.         '1.1首先进行单个不能为空或不能为零判断(Fixed)
  821.         For jsqte = Qslz To .Cols - 1
  822.                
  823.             '字段不能为空
  824.             If GridInt(jsqte, 5) = 1 Then
  825.                 If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  826.                     Tsxx = GridStr(jsqte, 2)
  827.                     Lrywlz = jsqte
  828.                     GoTo Lrcwcl
  829.                     Exit For
  830.                 End If
  831.             End If
  832.                
  833.             '字段不能为零
  834.             If GridInt(jsqte, 5) = 2 Then
  835.                 If Val(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  836.                     Tsxx = GridStr(jsqte, 2)
  837.                     Lrywlz = jsqte
  838.                     GoTo Lrcwcl
  839.                     Exit For
  840.                 End If
  841.             End If
  842.                
  843.             Next jsqte
  844.         '1.2进行其他有效性判断,编写格式同1.1
  845.             
  846.         '2.放置行处理程序(当数据行通过有效性判断)
  847.        
  848.         On Error GoTo Swcwcl
  849.         Cw_DataEnvi.DataConnect.BeginTrans
  850.          
  851.          With RecTemp
  852.             '判断此行记录ID是否为零,如不为零则修改记录;否则为新增记录,然后将新增后记录ID回写网格
  853.             If Val(Trim(WglrGrid.TextMatrix(Yxxpdh, 1))) <> 0 Then
  854.                 If .State = 1 Then .Close
  855.                 .Open "SELECT Dev_Amplidyne.* From Dev_Amplidyne WHERE AmplidyneID = " & Val(WglrGrid.TextMatrix(Yxxpdh, 1)), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  856.                 If Not .EOF Then
  857.                     .Fields("DEVID") = Label(0).Caption                                                                      '设备编号
  858.                     .Fields("EmpCode") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls)))                    '电机编号
  859.                     .Fields("EmpName") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))                    '电机名称
  860.                     .Fields("EmpModel") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))                   '规格型号
  861.                     .Fields("Capacity") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))                    '容量(千瓦)
  862.                     .Fields("Manufacturer") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls)))               '制造厂商
  863.                     .Fields("OurDate") = Format((WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls))), "yyyy-mm-dd")  '出厂日期
  864.                     .Fields("OutNumber") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))                  '出厂编号
  865.                     .Update
  866.                 End If
  867.                  
  868.             Else
  869.                
  870.                 If .State = 1 Then .Close
  871.                 .Open "SELECT Dev_Amplidyne.* From Dev_Amplidyne WHERE 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  872.                  
  873.                 .AddNew
  874.                     .Fields("DEVID") = Label(0).Caption                                                                      '设备编号
  875.                     .Fields("EmpCode") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls)))                    '电机编号
  876.                     .Fields("EmpName") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls)))                    '电机名称
  877.                     .Fields("EmpModel") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("003", GridStr(), Szzls)))                   '规格型号
  878.                     .Fields("Capacity") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("004", GridStr(), Szzls)))                    '容量(千瓦)
  879.                     .Fields("Manufacturer") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("005", GridStr(), Szzls)))               '制造厂商
  880.                     If (WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls))) <> "" Then
  881.                         .Fields("OurDate") = Format((WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls))), "yyyy-mm-dd") '出厂日期
  882.                     End If
  883.                     .Fields("OutNumber") = Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))                  '出厂编号
  884.                 .Update
  885.                     
  886.                 WglrGrid.TextMatrix(Yxxpdh, 1) = .Fields("AmplidyneID")                                                '电机ID
  887.                     
  888.             End If
  889.                  
  890.         End With
  891.         Cw_DataEnvi.DataConnect.CommitTrans
  892.          
  893.     End With
  894.     '以上为自定义部分]
  895.     Sjhzyxxpd = True
  896.     Hyxxpdlock = True
  897.     Exit Function
  898. Swcwcl:
  899.     Cw_DataEnvi.DataConnect.RollbackTrans
  900.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  901.     Call Xtxxts(Tsxx, 0, 1)
  902.     Exit Function
  903. Lrcwcl:      '录入错误处理
  904.     With WglrGrid
  905.         Call Xtxxts(Tsxx, 0, 1)
  906.         Changelock = True
  907.         .Select Yxxpdh, Lrywlz
  908.         Changelock = False
  909.         Call xswbk
  910.         Sjhzyxxpd = False
  911.         Exit Function
  912.     End With
  913.     
  914. End Function
  915. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改(程序动作部分)======================='
  916. Private Sub Sub_AdjustGrid()
  917.     '调 整 网 格
  918.     With WglrGrid
  919.         '加 1 保持一行录入行
  920.         If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  921.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  922.             For jsqte = .FixedRows To .Rows - 1
  923.                 .RowHeight(jsqte) = Sjhgd
  924.             Next jsqte
  925.         Else
  926.             '判断是否有辅助行和录入行,如没有则加行
  927.             Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
  928.                 .AddItem ""
  929.                 .RowHeight(.Rows - 1) = Sjhgd
  930.             Loop
  931.         End If
  932.     End With
  933.   
  934. End Sub
  935. Private Sub Lrzdbz()                                                      '录入字段帮助
  936.   
  937.     If Not Ydcommand.Visible Then
  938.         Exit Sub
  939.     End If
  940.    
  941.     With WglrGrid
  942.      
  943.         Valilock = True
  944.     
  945.         '处理通用部分
  946.         Changelock = True        '调入另外窗体必须加锁
  947.         Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  948.         Changelock = False
  949.         
  950.         If Len(Xtfhcs) <> 0 Then
  951.             If GridInt(.Col, 7) = 0 Then
  952.                 Ydtext.Text = Xtfhcs
  953.             Else
  954.                 Ydtext.Text = Xtfhcsfz
  955.             End If
  956.         End If
  957.             
  958.         Valilock = False
  959.         
  960.         If Ydtext.Visible Then
  961.             Ydtext.SetFocus
  962.         End If
  963.     
  964.     End With
  965.     
  966. End Sub
  967. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  968.    
  969.     Call Cxxswbk
  970.     
  971. End Sub
  972. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  973.   
  974.     Fun_Drfrmyxxpd = True
  975.     
  976.     With WglrGrid
  977.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  978.         
  979.         If Ydtext.Visible Or YdCombo.Visible Then
  980.             Call Lrsjhx
  981.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  982.                 Fun_Drfrmyxxpd = False
  983.                 Exit Function
  984.             End If
  985.         End If
  986.         
  987.         '进行行有效性判断
  988.         If Not Sjhzyxxpd(.Row) Then
  989.             Fun_Drfrmyxxpd = False
  990.             Exit Function
  991.         End If
  992.     End With
  993.   
  994. End Function
  995. Private Sub WglrGrid_EnterCell()                                                 '显示当前数据行相关信息
  996.    
  997.     With WglrGrid
  998.         If .Row >= .FixedRows Then
  999.             '[>>
  1000.                 '此处可以填写显示与此网格行相关信息
  1001.             '<<]
  1002.         End If
  1003.    End With
  1004.    
  1005. End Sub
  1006. Private Sub WglrGrid_GotFocus()                                     '网格得到焦点
  1007.     '网格得到焦点,如果当前选择行为非数据行
  1008.     '则调整当前焦点至有效数据行
  1009.     With WglrGrid
  1010.         If .Row < .FixedRows And .Rows > .FixedRows Then
  1011.             Changelock = True
  1012.             .Select .FixedRows, .Col
  1013.             Changelock = False
  1014.         End If
  1015.         If .Col < Qslz Then
  1016.             Changelock = True
  1017.             .Select .Row, Qslz
  1018.             Changelock = False
  1019.         End If
  1020.     End With
  1021. End Sub
  1022. Private Sub WglrGrid_LostFocus()                                    '录入网格失去焦点
  1023.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  1024.     If Changelock Then
  1025.         Exit Sub
  1026.     End If
  1027.     '引发网格RowcolChange事件
  1028.     With WglrGrid
  1029.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1030.             .Select 0, 0
  1031.         End If
  1032.     End With
  1033. End Sub
  1034. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                       '限制用户在录入过程中滚动鼠标
  1035.     If Gdtlock Then
  1036.         Exit Sub
  1037.     End If
  1038.  
  1039.     With WglrGrid
  1040.         If Ydtext.Visible Or YdCombo.Visible Then
  1041.             Gdtlock = True
  1042.             .TopRow = Dqtoprow
  1043.             .LeftCol = Dqleftcol
  1044.             Gdtlock = False
  1045.             Exit Sub
  1046.         End If
  1047.     End With
  1048.     
  1049. End Sub
  1050. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  1051.   
  1052.     If Changelock Then
  1053.         Exit Sub
  1054.     End If
  1055.     '记录刚刚离开网格单元的行列值
  1056.     Dqlkwgh = WglrGrid.Row
  1057.     Dqlkwgl = WglrGrid.Col
  1058.     '判断是否需要录入数据回写
  1059.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1060.         Exit Sub
  1061.     End If
  1062.     
  1063.     Call Lrsjhx
  1064.     
  1065. End Sub
  1066. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  1067.    
  1068.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  1069.     
  1070.     With WglrGrid
  1071.         If Changelock Then
  1072.             Exit Sub
  1073.         End If
  1074.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1075.             Exit Sub
  1076.         End If
  1077.         If .Row <> Dqlkwgh Then
  1078.             If Not Sjhzyxxpd(Dqlkwgh) Then
  1079.                 Exit Sub
  1080.             End If
  1081.         End If
  1082.     End With
  1083.     
  1084.     Call fhyxh
  1085.     Call Xldql
  1086.    
  1087. End Sub
  1088. Private Sub WglrGrid_DblClick()          '鼠标双击网格显示文本框
  1089.     With WglrGrid
  1090.         Call xswbk
  1091.     End With
  1092.   
  1093. End Sub
  1094. Private Sub Ycwbk()                      '隐藏文本框,帮助按钮,列表组合框
  1095.  
  1096.     Valilock = True
  1097.     Ydtext.Visible = False
  1098.     YdCombo.Visible = False
  1099.     Ydcommand.Visible = False
  1100.     
  1101. End Sub
  1102. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  1103.     With WglrGrid
  1104.         Select Case KeyCode
  1105.             Case vbKeyEscape                'ESC 键放弃录入
  1106.                 Valilock = True
  1107.                 .SetFocus
  1108.                 Call Ycwbk
  1109.                 Valilock = False
  1110.             Case vbKeyReturn                '回 车 键 =13
  1111.                 KeyCode = 0
  1112.                 .SetFocus
  1113.                 Call Lrsjhx
  1114.                 Rowjsq = .Row
  1115.                 Coljsq = .Col + 1
  1116.                 If Coljsq > .Cols - 1 Then
  1117.                     If Rowjsq < .Rows - 1 Then
  1118.                         Rowjsq = Rowjsq + 1
  1119.                     End If
  1120.                     Coljsq = Qslz
  1121.                 End If
  1122.                 Do While Rowjsq <= .Rows - 1
  1123.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1124.                         Coljsq = Coljsq + 1
  1125.                         If Coljsq > .Cols - 1 Then
  1126.                             Rowjsq = Rowjsq + 1
  1127.                             Coljsq = Qslz
  1128.                         End If
  1129.                     Else
  1130.                         Exit Do
  1131.                     End If
  1132.                 Loop
  1133.                 .Select Rowjsq, Coljsq
  1134.                 
  1135.             Case vbKeyLeft                  '左 箭 头 =37
  1136.                 If .Col - 1 = Qslz Then
  1137.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1138.                         GoTo jzzx
  1139.                     End If
  1140.                 End If
  1141.                 If .Col > Qslz Then
  1142.                     KeyCode = 0
  1143.                     .SetFocus
  1144.                     Call Lrsjhx
  1145.                     Coljsq = .Col - 1
  1146.                     Do While Coljsq > Qslz
  1147.                         If Coljsq - 1 = Qslz Then
  1148.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1149.                                 GoTo jzzx
  1150.                             End If
  1151.                         End If
  1152.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1153.                             Coljsq = Coljsq - 1
  1154.                         Else
  1155.                             Exit Do
  1156.                         End If
  1157.                     Loop
  1158.                     .Select .Row, Coljsq
  1159.                 End If
  1160.             Case vbKeyRight                 '右 箭 头 =39
  1161.                 KeyCode = 0
  1162.                 .SetFocus
  1163.                 Call Lrsjhx
  1164.                 Rowjsq = .Row
  1165.                 Coljsq = .Col + 1
  1166.                 If Coljsq > .Cols - 1 Then
  1167.                     If Rowjsq < .Rows - 1 Then
  1168.                         Rowjsq = Rowjsq + 1
  1169.                     End If
  1170.                     Coljsq = Qslz
  1171.                 End If
  1172.                 Do While Rowjsq <= .Rows - 1
  1173.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1174.                         Coljsq = Coljsq + 1
  1175.                         If Coljsq > .Cols - 1 Then
  1176.                             Rowjsq = Rowjsq + 1
  1177.                             Coljsq = Qslz
  1178.                         End If
  1179.                     Else
  1180.                         Exit Do
  1181.                     End If
  1182.                 Loop
  1183.                 .Select Rowjsq, Coljsq
  1184.             Case Else
  1185.             
  1186.         End Select
  1187.    
  1188. jzzx:
  1189.    
  1190.     End With
  1191.     
  1192. End Sub
  1193. Private Sub YdCombo_LostFocus()
  1194.   
  1195.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1196.         If Not Valilock Then                           '为TRUE
  1197.             Call Lrsjhx
  1198.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1199.                 Exit Sub
  1200.             End If
  1201.         End If
  1202.     End With
  1203. End Sub
  1204. Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1205.    
  1206.     Call Lrzdbz
  1207.    
  1208. End Sub
  1209. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1210.    
  1211.     Dim Rowjsq As Long, Coljsq As Long
  1212.     
  1213.     With WglrGrid
  1214.         Select Case KeyCode
  1215.             Case vbKeyF2
  1216.                 Call Lrzdbz
  1217.             Case vbKeyEscape                'ESC 键放弃录入
  1218.                 Valilock = True
  1219.                 Call Ycwbk
  1220.                 .SetFocus
  1221.             Case vbKeyReturn                '回 车 键 =13
  1222.                 KeyCode = 0
  1223.                 .SetFocus
  1224.                 Call Lrsjhx
  1225.                 Rowjsq = .Row
  1226.                 Coljsq = .Col + 1
  1227.                 If Coljsq > .Cols - 1 Then
  1228.                     If Rowjsq < .Rows - 1 Then
  1229.                         Rowjsq = Rowjsq + 1
  1230.                     End If
  1231.                     Coljsq = Qslz
  1232.                 End If
  1233.                 Do While Rowjsq <= .Rows - 1
  1234.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1235.                         Coljsq = Coljsq + 1
  1236.                         If Coljsq > .Cols - 1 Then
  1237.                             Rowjsq = Rowjsq + 1
  1238.                             Coljsq = Qslz
  1239.                         End If
  1240.                     Else
  1241.                         Exit Do
  1242.                     End If
  1243.                 Loop
  1244.                 If Rowjsq <= .Rows - 1 Then
  1245.                     .Select Rowjsq, Coljsq
  1246.                 End If
  1247.                 
  1248.             Case vbKeyUp                    '上 箭 头 =38
  1249.                 KeyCode = 0
  1250.                 .SetFocus
  1251.                 Call Lrsjhx
  1252.                 If .Row > .FixedRows Then
  1253.                     .Row = .Row - 1
  1254.                 End If
  1255.                 
  1256.             Case vbKeyDown                  '下 箭 头 =40
  1257.                 KeyCode = 0
  1258.                 .SetFocus
  1259.                 Call Lrsjhx
  1260.                 If .Row < .Rows - 1 Then
  1261.                     .Row = .Row + 1
  1262.                 End If
  1263.                 
  1264.             Case vbKeyLeft                  '左 箭 头 =37
  1265.                 If .Col - 1 = Qslz Then
  1266.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1267.                         GoTo jzzx
  1268.                     End If
  1269.                 End If
  1270.                 If Ydtext.SelStart = 0 And .Col > Qslz Then
  1271.                     KeyCode = 0
  1272.                     .SetFocus
  1273.                     Call Lrsjhx
  1274.                     Coljsq = .Col - 1
  1275.                     Do While Coljsq > Qslz
  1276.                         If Coljsq - 1 = Qslz Then
  1277.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1278.                                 GoTo jzzx
  1279.                             End If
  1280.                         End If
  1281.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1282.                             Coljsq = Coljsq - 1
  1283.                         Else
  1284.                             Exit Do
  1285.                         End If
  1286.                     Loop
  1287.                     .Select .Row, Coljsq
  1288.                 End If
  1289. jzzx:
  1290.            
  1291.             Case vbKeyRight                 '右 箭 头 =39
  1292.                 wblong = Len(Ydtext.Text)
  1293.                 If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1294.                     KeyCode = 0
  1295.                     .SetFocus
  1296.                     Call Lrsjhx
  1297.                     Rowjsq = .Row
  1298.                     Coljsq = .Col + 1
  1299.                     If Coljsq > .Cols - 1 Then
  1300.                         If Rowjsq < .Rows - 1 Then
  1301.                             Rowjsq = Rowjsq + 1
  1302.                         End If
  1303.                         Coljsq = Qslz
  1304.                     End If
  1305.                     Do While Rowjsq <= .Rows - 1
  1306.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1307.                             Coljsq = Coljsq + 1
  1308.                             If Coljsq > .Cols - 1 Then
  1309.                                 Rowjsq = Rowjsq + 1
  1310.                                 Coljsq = Qslz
  1311.                             End If
  1312.                         Else
  1313.                             Exit Do
  1314.                         End If
  1315.                     Loop
  1316.                     .Select Rowjsq, Coljsq
  1317.                 End If
  1318.             Case Else
  1319.             
  1320.         End Select
  1321.     End With
  1322.     
  1323. End Sub
  1324. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  1325.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1326.     
  1327.     If KeyAscii <> 0 Then
  1328.         Call Xyxhbz(Dqlrwgh)
  1329.     End If
  1330.     
  1331. End Sub
  1332. Private Sub ydtext_Change()                              '录入事中变化处理
  1333.     '防止程序改变但不进行处理
  1334.     If Wbkbhlock Then
  1335.         Exit Sub
  1336.     End If
  1337.     With WglrGrid
  1338.         '限制字段录入长度
  1339.          Wbkbhlock = True
  1340.          Call TextChangeLimit(Ydtext, GridInt(.Col, 1))  '去掉无效字符
  1341.         Select Case GridInt(.Col, 1)
  1342.             Case 8, 11   '金额型
  1343.                 Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  1344.             Case 9, 12   '数量型
  1345.                 Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  1346.             Case 10      '单价型
  1347.                 Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1348.             Case Else    '其他类型
  1349.                 If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  1350.                     Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  1351.                 End If
  1352.         End Select
  1353.         Wbkbhlock = False
  1354.     End With
  1355.     
  1356. End Sub
  1357. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  1358.   
  1359.     With WglrGrid
  1360.         If Not Valilock Then
  1361.             Call Lrsjhx
  1362.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1363.                 Exit Sub
  1364.             End If
  1365.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1366.                 Exit Sub
  1367.             End If
  1368.         End If
  1369.     End With
  1370.   
  1371. End Sub
  1372. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  1373.     
  1374.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  1375.   
  1376.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  1377.     If Not Fun_AllowInput Then
  1378.         Exit Sub
  1379.     End If
  1380.   
  1381.     '显示文本框前返回有效行列(解决滚动条问题)
  1382.     Call Xldqh
  1383.     Call Xldql
  1384.   
  1385.     '隐藏文本框,帮助按钮,列表组合框
  1386.     Call Ycwbk
  1387.   
  1388.     With WglrGrid
  1389.         Dqlrwgh = .Row
  1390.         Dqlrwgl = .Col
  1391.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1392.             Exit Sub
  1393.         End If
  1394.      
  1395.         Wbkpy = 30
  1396.         Wbkpy1 = 15
  1397.     
  1398.         If GridBoolean(.Col, 3) Then
  1399.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1400.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1401.             YdCombo.Width = .CellWidth - Wbkpy1
  1402.             Call Wbkcl
  1403.             YdCombo.Visible = True
  1404.             YdCombo.SetFocus
  1405.             Ydcommand.Visible = False
  1406.             Ydtext.Visible = False
  1407.         Else
  1408.             If GridBoolean(.Col, 2) Then
  1409.                 Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1410.                 Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1411.                 Ydcommand.Visible = True
  1412.             Else
  1413.                 Ydcommand.Visible = False
  1414.             End If
  1415.      
  1416.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1417.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1418.             
  1419.             If Ydcommand.Visible Then
  1420.                 If Sfblbzkd Then
  1421.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1422.                 Else
  1423.                     Ydtext.Width = .CellWidth - Wbkpy1
  1424.                 End If
  1425.             Else
  1426.                 Ydtext.Width = .CellWidth - Wbkpy1
  1427.             End If
  1428.             
  1429.             Ydtext.Height = .CellHeight - Wbkpy1
  1430.       
  1431.             If GridInt(.Col, 2) <> 0 Then
  1432.                 Ydtext.MaxLength = GridInt(.Col, 2)
  1433.             Else
  1434.                 Ydtext.MaxLength = 3000
  1435.             End If
  1436.       
  1437.             Call Wbkcl
  1438.       
  1439.             Ydtext.Visible = True
  1440.             Ydtext.SetFocus
  1441.         End If
  1442.         
  1443.         Dqtoprow = .TopRow
  1444.         Dqleftcol = .LeftCol
  1445.     
  1446.         '重置锁值
  1447.         Valilock = False
  1448.         Wbkbhlock = False
  1449.         
  1450.     End With
  1451.  
  1452. End Sub
  1453. Private Function Fun_AllowInput() As Boolean                           '当某种条件成立时禁止文本框激活使单据处于录入状态
  1454.    
  1455.     '如果单据操作状态为浏览状态则不能显示录入载体(通用)
  1456.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1457.         Exit Function
  1458.     End If
  1459.    
  1460.     '[>>
  1461.     
  1462.         '此处可以填写禁止文本框激活使单据处于录入状态的理由
  1463.    
  1464.     '<<]
  1465.    
  1466.     Fun_AllowInput = True
  1467.     
  1468. End Function
  1469. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  1470.                    
  1471.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  1472.   
  1473.     Wbkpy = 30
  1474.     Wbkpy1 = 15
  1475.     
  1476.     With WglrGrid
  1477.         If YdCombo.Visible Then
  1478.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1479.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1480.             YdCombo.Width = .CellWidth - Wbkpy1
  1481.         End If
  1482.         If Ydcommand.Visible Then
  1483.             Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
  1484.             Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
  1485.         End If
  1486.         If Ydtext.Visible Then
  1487.             If Ydcommand.Visible Then
  1488.                 If Sfblbzkd Then
  1489.                     Ydtext.Width = .CellWidth - Ydcommand.Width
  1490.                 Else
  1491.                     Ydtext.Width = .CellWidth - Wbkpy1
  1492.                 End If
  1493.             Else
  1494.                 Ydtext.Width = .CellWidth - Wbkpy1
  1495.             End If
  1496.       
  1497.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1498.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1499.             Ydtext.Height = .CellHeight - Wbkpy1
  1500.         End If
  1501.    End With
  1502. End Sub
  1503. Private Sub Lrsjhx()                                                   '文本框录入数据回写
  1504.   
  1505.     With WglrGrid
  1506.         If YdCombo.Visible Then
  1507.             .Text = Trim(YdCombo.Text)
  1508.         End If
  1509.         If Ydtext.Visible Then
  1510.             .Text = Trim(Ydtext.Text)
  1511.         End If
  1512.    
  1513.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  1514.         If Zdlrqnr <> Trim(.Text) Then
  1515.             Yxxpdlock = False
  1516.             Hyxxpdlock = False
  1517.         End If
  1518.    
  1519.         '如果字段录入内容不为空则写数据行有效性标志
  1520.    
  1521.         If Len(Trim(.Text)) <> 0 Then
  1522.             Call Xyxhbz(.Row)
  1523.         End If
  1524.    
  1525.         '隐藏文本框,帮助按钮,列表组合框
  1526.         Call Ycwbk
  1527.     End With
  1528.     
  1529. End Sub
  1530. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)    '网格录入增行,删行快捷键
  1531.   
  1532.     '如果单据操作状态为浏览状态则不能显示录入载体
  1533.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1534.         Exit Sub
  1535.     End If
  1536.     Select Case KeyCode
  1537.         Case vbKeyF2                   '按F2键参照
  1538.             Call xswbk
  1539.         Call Lrzdbz
  1540.             Case vbKeyDelete               '删行
  1541.         Call Scdqfl
  1542.             Case vbKeyInsert               '增行
  1543.         Call zjlrfl
  1544.     End Select
  1545.     
  1546. End Sub
  1547. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                             '网格接受键盘录入
  1548.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  1549.     If Not Fun_AllowInput Then
  1550.         Exit Sub
  1551.     End If
  1552.   
  1553.     With WglrGrid
  1554.   
  1555.         '屏 蔽 回 车 键
  1556.         If KeyAscii = vbKeyReturn Then
  1557.             KeyAscii = 0
  1558.             Rowjsq = .Row
  1559.             Coljsq = .Col + 1
  1560.             If Coljsq > .Cols - 1 Then
  1561.                 If Rowjsq < .Rows - 1 Then
  1562.                     Rowjsq = Rowjsq + 1
  1563.                 End If
  1564.                 Coljsq = Qslz
  1565.             End If
  1566.             Do While Rowjsq <= .Rows - 1
  1567.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1568.                     Coljsq = Coljsq + 1
  1569.                     If Coljsq > .Cols - 1 Then
  1570.                         Rowjsq = Rowjsq + 1
  1571.                         Coljsq = Qslz
  1572.                     End If
  1573.                 Else
  1574.                     Exit Do
  1575.                 End If
  1576.             Loop
  1577.           
  1578.             If Rowjsq <= .Rows - 1 Then
  1579.                .Select Rowjsq, Coljsq
  1580.             End If
  1581.        
  1582.              Exit Sub
  1583.         End If
  1584.      
  1585.         '接受用户录入
  1586.         Select Case KeyAscii
  1587.             Case 0 To 32             '用户输入KeyAscii为0-32的键 如空格
  1588.           
  1589.                 '显示录入载体
  1590.                 Call xswbk
  1591.             Case Else
  1592.                 '防止非编辑字段SendKeys()出现死循环
  1593.                 If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1594.                    Exit Sub
  1595.                 End If
  1596.                 '如果此字段为列表框录入则调入相应列表框
  1597.                 If GridBoolean(.Col, 3) Then
  1598.                     '列表框录入
  1599.                     Call xswbk
  1600.                 Else
  1601.                     Ydtext.Text = ""
  1602.             
  1603.                     '录入限制
  1604.                     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1605.             
  1606.                     If KeyAscii = 0 Then
  1607.                         Exit Sub
  1608.                     End If
  1609.                     '如果录入字符有效则写有效行数据标志
  1610.                     Call Xyxhbz(.Row)
  1611.                     Call xswbk
  1612.                     Ydtext.Text = ""
  1613.                     Valilock = True
  1614.                     SendKeys Chr(KeyAscii), True
  1615.                     DoEvents
  1616.                     Valilock = False
  1617.                 End If
  1618.         End Select
  1619.     End With
  1620.         
  1621. End Sub
  1622. Private Sub zjlrfl()                                                    '增加录入分录
  1623.   
  1624.     With WglrGrid
  1625.   
  1626.         '处于录入状态不能增行
  1627.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  1628.             If Not Fun_Drfrmyxxpd Then
  1629.                 Exit Sub
  1630.             End If
  1631.         Else
  1632.             Exit Sub
  1633.         End If
  1634.     
  1635.         '处于非数据行和最后一行时不能增行
  1636.         If .Row < .FixedRows Or .Row = .Rows - 1 Then
  1637.             Exit Sub
  1638.         End If
  1639.     
  1640.         .AddItem "", .Row
  1641.         .RowHeight(.Row) = Sjhgd
  1642.     
  1643.         If .Row <> .Rows - 1 Then
  1644.             If .TextMatrix(.Row + 1, 0) = "*" Then
  1645.                 .TextMatrix(.Row, 0) = "*"
  1646.             Else
  1647.                 .RemoveItem .Rows - 1
  1648.             End If
  1649.         End If
  1650.         Call Xldqh
  1651.         Call Xldql
  1652.         Hyxxpdlock = False
  1653.     End With
  1654.     
  1655. End Sub
  1656. Private Sub Scdqfl()                                                    '删除当前分录
  1657.  
  1658.     Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean '(Fixed)
  1659.     Dim Sqlstr As String   '临时使用连接字符串
  1660.  
  1661.     With WglrGrid
  1662.         Scqwghz = .Row
  1663.         Scqwglz = .Col
  1664.         
  1665.         If .TextMatrix(.Row, 0) = "*" Then
  1666.             '判断是否为录入状态
  1667.             If Ydtext.Visible Or YdCombo.Visible Then
  1668.                 Sflrzt = True
  1669.                 Validate = True
  1670.                 Call Lrsjhx
  1671.                 Validate = False
  1672.             End If
  1673.        
  1674.             Call Xldqh
  1675.             Changelock = True
  1676.             .Select .Row, 0
  1677.             Changelock = False
  1678.             If Shsfts Then
  1679.                 .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
  1680.                 Tsxx = "请确认是否删除当前记录?"
  1681.                 Yhanswer = Xtxxts(Tsxx, 2, 2)
  1682.                 If Yhanswer = 2 Then
  1683.                     .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
  1684.                     Changelock = True
  1685.                     .Select Scqwghz, Scqwglz
  1686.                     Changelock = False
  1687.               
  1688.                     '如为录入状态,则恢复录入
  1689.                     If Sflrzt Then
  1690.                        Call xswbk
  1691.                     End If
  1692.               
  1693.                     Exit Sub
  1694.                 End If
  1695.             End If
  1696.        
  1697.             '[>>以下为自定义部分
  1698.        
  1699.             On Error GoTo Swcwcl
  1700.     
  1701.             Cw_DataEnvi.DataConnect.BeginTrans
  1702.        
  1703.             If Val(WglrGrid.TextMatrix(.Row, 1)) <> 0 Then
  1704.                 Sqlstr = "Delete Dev_Amplidyne From Dev_Amplidyne WHERE AmplidyneID = " & Val(WglrGrid.TextMatrix(.Row, 1))
  1705.                 Cw_DataEnvi.DataConnect.Execute (Sqlstr)
  1706.             End If
  1707.        
  1708.             Cw_DataEnvi.DataConnect.CommitTrans
  1709.        
  1710.             '<<以上为自定义部分]
  1711.        
  1712.             .RemoveItem .Row
  1713.  
  1714.             If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1715.                 .AddItem ""
  1716.                 .RowHeight(.Rows - 1) = Sjhgd
  1717.             End If
  1718.             
  1719.             Changelock = True
  1720.             .Select .Row, Scqwglz
  1721.             Changelock = False
  1722.         End If
  1723.         
  1724.     End With
  1725.  
  1726.     Exit Sub
  1727.  
  1728.     '[>>事务错误处理
  1729.     
  1730. Swcwcl:
  1731.     Cw_DataEnvi.DataConnect.RollbackTrans
  1732.     
  1733.     Tsxx = "删除过程中出现错误!"
  1734.     Call Xtxxts(Tsxx, 0, 1)
  1735.     Exit Sub
  1736.     '<<]
  1737. End Sub
  1738. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  1739.     If Not GridBoolean(Sjl, 5) Then
  1740.         Exit Sub
  1741.     End If
  1742.     
  1743.     With WglrGrid
  1744.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  1745.             .TextMatrix(sjh, Sjl) = ""
  1746.         End If
  1747.     End With
  1748.   
  1749. End Sub
  1750. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  1751.   
  1752.     With WglrGrid
  1753.         If .Row >= .FixedRows Then
  1754.             If .TextMatrix(.Row, 0) <> "*" Then
  1755.                 For Rowjsq = .FixedRows To .Rows - 1
  1756.                     If .TextMatrix(Rowjsq, 0) <> "*" Then
  1757.                         Exit For
  1758.                     End If
  1759.                 Next Rowjsq
  1760.                 If Rowjsq <= .Rows - 1 Then
  1761.                     Changelock = True
  1762.                     .Select Rowjsq, .Col
  1763.                     Changelock = False
  1764.                 Else
  1765.                     Changelock = True
  1766.                     .Select .Rows - 1, .Col
  1767.                     Changelock = False
  1768.                 End If
  1769.             End If
  1770.             Call Xldqh
  1771.         End If
  1772.   End With
  1773.   
  1774. End Sub
  1775. Private Sub Xldqh()                                                      '显露当前行
  1776.     Dim Toprowte As Long
  1777.     
  1778.     With WglrGrid
  1779.         Toprowte = 0
  1780.         
  1781.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  1782.             Toprowte = .TopRow
  1783.             .TopRow = .TopRow + 1
  1784.         Loop
  1785.         
  1786.         Toprowte = 0
  1787.         
  1788.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  1789.             Toprowte = .TopRow
  1790.             .TopRow = .TopRow - 1
  1791.         Loop
  1792.     End With
  1793.     
  1794. End Sub
  1795. Private Sub Xldql()                                                     '显露当前列
  1796.  
  1797.     Dim Leftcolte As Long
  1798.     
  1799.     With WglrGrid
  1800.         If .Col >= Qslz And .Col >= .FixedCols Then
  1801.             If .LeftCol > .Col Then
  1802.                 .LeftCol = .Col
  1803.             End If
  1804.             Leftcolte = 0
  1805.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  1806.                 Leftcolte = .LeftCol
  1807.                 .LeftCol = .LeftCol + 1
  1808.             Loop
  1809.         End If
  1810.     End With
  1811.     
  1812. End Sub
  1813. Private Function pdhwk(sjh As Long)                                     '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
  1814.  
  1815.     With WglrGrid
  1816.         For Coljsq = Qslz To .Cols - 1
  1817.             If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
  1818.                 pdhwk = False
  1819.                 Exit Function
  1820.             End If
  1821.         Next Coljsq
  1822.         pdhwk = True
  1823.     End With
  1824.     
  1825. End Function
  1826. Private Sub Xyxhbz(sjh As Long)                                         '写行有效性标志,并判断是否增行
  1827.    
  1828.    With WglrGrid
  1829.         If .TextMatrix(sjh, 0) = "*" Then
  1830.             Exit Sub
  1831.         End If
  1832.         .TextMatrix(sjh, 0) = "*"
  1833.         If sjh >= .Rows - Fzxwghs - 1 Then
  1834.             .AddItem ""
  1835.             .RowHeight(.Rows - 1) = Sjhgd
  1836.         End If
  1837.    End With
  1838.    
  1839. End Sub
  1840. Private Sub WglrGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)           '网格列发生移动时自动交换网格索引信息
  1841.     
  1842.     Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
  1843. End Sub
  1844. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1845.     
  1846.     Select Case Button.Key
  1847.         Case "bcgs"                                       '保存表格格式
  1848.             Call Bcwggs(WglrGrid, GridCode, GridStr())
  1849.         Case "hfmrgs"                                     '恢复默认格式
  1850.             Call Hfmrgs(WglrGrid, GridCode, GridStr())
  1851.     End Select
  1852.     
  1853. End Sub
  1854. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1855.   
  1856.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1857.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1858.     Bbxbtgs = 3                                          '报 表 小 标 题 行 数
  1859.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1860.     ReDim Bbxbt(1 To Bbxbtgs)
  1861.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1862.     
  1863.     If Bbbwhgs <> 0 Then
  1864.         ReDim Bbbwh(1 To Bbbwhgs)
  1865.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1866.     End If
  1867.     
  1868.     Bbzbt = ReportTitle
  1869.     
  1870.     Bbxbt(1) = Bbxbt(1) + Fun_FormatOutPut("设备编号: " + Trim(Label(0).Caption), 50)
  1871.     Bbxbt(1) = Bbxbt(1) + Fun_FormatOutPut("设备名称: " + Trim(Label(1).Caption), 50)
  1872.     Bbxbt(2) = Bbxbt(2) + Fun_FormatOutPut("设备型号: " + Trim(Label(2).Caption), 50)
  1873.     Bbxbt(2) = Bbxbt(2) + Fun_FormatOutPut("所属部门: " + Trim(Label(3).Caption), 50)
  1874.     
  1875.     Call Scyxsjb(WglrGrid)                               '生成报表数据
  1876.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1877.   
  1878.     If Not bbylte Then
  1879.         Unload DY_Tybbyldy
  1880.     End If
  1881.     
  1882. End Sub