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

企业管理

开发平台:

Visual Basic

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