⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productcycle.frm

📁 生产计划管理等信息 可以查询计划完成情况等
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form ProductCycle 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "表计生产周期"
   ClientHeight    =   5910
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9030
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5910
   ScaleWidth      =   9030
   StartUpPosition =   3  '窗口缺省
   Begin VB.CheckBox chk 
      BackColor       =   &H00FFFFFF&
      Height          =   225
      Left            =   5280
      TabIndex        =   10
      Top             =   2520
      Visible         =   0   'False
      Width           =   250
   End
   Begin VB.TextBox txt 
      Appearance      =   0  'Flat
      BorderStyle     =   0  'None
      Height          =   255
      Left            =   3000
      TabIndex        =   9
      Top             =   2160
      Visible         =   0   'False
      Width           =   975
   End
   Begin VB.CommandButton Command3 
      Caption         =   "表型添加"
      Height          =   375
      Left            =   6000
      TabIndex        =   8
      Top             =   200
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "保存设置"
      Height          =   375
      Left            =   7440
      TabIndex        =   7
      Top             =   200
      Width           =   975
   End
   Begin VB.ComboBox BZ 
      Height          =   300
      Left            =   3720
      TabIndex        =   4
      Top             =   240
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Height          =   300
      Left            =   5085
      Picture         =   "ProductCycle.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   240
      Width           =   300
   End
   Begin VB.ComboBox BM 
      Height          =   300
      Left            =   1080
      TabIndex        =   1
      Top             =   240
      Width           =   1335
   End
   Begin VB.CommandButton Command4 
      Height          =   300
      Left            =   2445
      Picture         =   "ProductCycle.frx":058A
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   240
      Width           =   300
   End
   Begin MSFlexGridLib.MSFlexGrid Grid 
      Height          =   4695
      Left            =   240
      TabIndex        =   6
      Top             =   960
      Width           =   8535
      _ExtentX        =   15055
      _ExtentY        =   8281
      _Version        =   393216
      Cols            =   6
      FixedCols       =   0
      BackColor       =   16777215
      BackColorBkg    =   -2147483633
      GridColor       =   14737632
      GridColorFixed  =   -2147483632
      GridLinesFixed  =   1
      AllowUserResizing=   1
      FormatString    =   ">表计类型|>生产单位(台)|>使用时间(小时)|>接收延时(小时)|>累积加时|>基准"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Times New Roman"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000010&
      X1              =   240
      X2              =   8760
      Y1              =   720
      Y2              =   720
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "班组选择"
      Height          =   180
      Left            =   2880
      TabIndex        =   5
      Top             =   330
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "部门选择"
      Height          =   180
      Left            =   240
      TabIndex        =   2
      Top             =   330
      Width           =   720
   End
End
Attribute VB_Name = "ProductCycle"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub BM_Click()
  TeamsToCombo BZ, BM.Text
  LoadMeterType Grid, BM.Text
End Sub

Private Sub BZ_Click()
  LoadMeterConfig Grid, Trim(BM.Text), Trim(BZ.Text)
End Sub

Private Sub chk_Click()
  Grid.TextMatrix(Grid.Row, Grid.Col) = IIf(chk.Value = 1, "√", "×")
End Sub

Private Sub Command1_Click()
  TeamsInfo.Show vbModal
End Sub

Private Sub Command2_Click()
If MsgBox("是否确定保存当前配置", vbInformation Or vbYesNo, "提示") = vbYes Then
  SaveConfig Grid, Trim(BM.Text), Trim(BZ.Text)
End If
End Sub

Private Sub Command3_Click()
  MeterType.Show vbModal
End Sub

Private Sub Command4_Click()
  DepartmentInfo.Show vbModal
  DepartToCombo BM
End Sub

Private Sub Form_Load()
  Me.Left = (Screen.Width - Me.Width) / 2
  Me.Top = (Screen.Height - Me.Height) / 2
  DepartToCombo BM
  
  Grid.ColAlignment(0) = flexAlignCenterCenter
  Grid.ColAlignment(1) = flexAlignCenterCenter
  Grid.ColAlignment(2) = flexAlignCenterCenter
  Grid.ColAlignment(3) = flexAlignCenterCenter
  Grid.ColAlignment(4) = flexAlignCenterCenter
  Grid.ColAlignment(5) = flexAlignCenterCenter
  
  ConvertFont Me
End Sub

Private Sub Grid_EnterCell()

' Command1.Visible = False
 txt.Visible = False
 chk.Visible = False
' chs.Visible = False
 
 Select Case Grid.Col

   Case 1, 2, 3

        txt.Text = Grid.TextMatrix(Grid.Row, Grid.Col)
        txt.Left = Grid.CellLeft + Grid.Left
        txt.Top = Grid.CellTop + Grid.Top
        txt.Width = Grid.CellWidth
        txt.Height = Grid.CellHeight
        txt.Visible = True
        
   Case 4, 5
   
        On Error Resume Next
        chk.Value = IIf(Grid.TextMatrix(Grid.Row, Grid.Col) = "√", 1, 0)
        chk.Left = Grid.CellLeft + Grid.Left + Grid.CellWidth / 2 - chk.Width / 2
        chk.Top = Grid.CellTop + Grid.Top
        chk.Visible = True

 End Select
End Sub

Private Sub txt_Change()
      Grid.TextMatrix(Grid.Row, Grid.Col) = txt.Text
End Sub

'===========================================================

Private Sub LoadMeterType(Flex As MSFlexGrid, Bumen As String)
   If rs.State = 1 Then rs.Close
   rs.Open "select * from 表计类型 where 部门名称='" & Bumen & "'", DBConn, adOpenKeyset, adLockOptimistic, adCmdText
   If Not rs.EOF Then
     Flex.Rows = rs.RecordCount + 1
     Dim i
     For i = 1 To rs.RecordCount
       Flex.TextMatrix(i, 0) = rs.Fields("表计类型").Value
       Flex.TextMatrix(i, 4) = "×"
       'Flex.TextMatrix(i, 5) = "×"
       rs.MoveNext
     Next i
   End If
End Sub

Private Sub LoadMeterConfig(Flex As MSFlexGrid, Bumen As String, BanZu As String)
    Dim i As Integer
    For i = 1 To Flex.Rows - 1
      Dim Mtype As String
      Mtype = Flex.TextMatrix(i, 0)
      '生产周期表
      SQL = "Select * from 生产周期 where 部门名称='" & Bumen & "' and 班组名称='" & BanZu & "' and 表计类型='" & Mtype & "'"
      If rs.State = 1 Then rs.Close
      rs.Open SQL, DBConn, adOpenKeyset, adLockOptimistic, adCmdText
      If Not rs.EOF Then
         Flex.TextMatrix(i, 1) = rs.Fields("生产单位").Value
         Flex.TextMatrix(i, 2) = rs.Fields("生产周期").Value
         Flex.TextMatrix(i, 3) = rs.Fields("接收延时").Value
         Flex.TextMatrix(i, 4) = IIf(rs.Fields("加时累计").Value = True, "√", "×")
      Else
         Flex.TextMatrix(i, 1) = ""
         Flex.TextMatrix(i, 2) = ""
         Flex.TextMatrix(i, 3) = ""
         Flex.TextMatrix(i, 4) = ""
      End If
      '班组产能表
      SQL = "Select * from 每日产能 where 部门名称='" & Bumen & "' and 班组名称='" & BanZu & "' and 表计类型='" & Mtype & "' and 基准=TRUE"
      If rs.State = 1 Then rs.Close
      rs.Open SQL, DBConn, adOpenKeyset, adLockOptimistic, adCmdText
      If Not rs.EOF Then
         Flex.TextMatrix(i, 5) = "√"
      Else
         Flex.TextMatrix(i, 5) = ""
      End If
      
    Next i
End Sub

Private Sub SaveConfig(Flex As MSFlexGrid, Bumen As String, BanZu As String)
    
    Dim i As Integer
    For i = 1 To Flex.Rows - 1
      Dim Mtype As String
      Mtype = Flex.TextMatrix(i, 0)
      '生产周期表
      SQL = "Select * from 生产周期 where 部门名称='" & Bumen & "' and 班组名称='" & BanZu & "' and 表计类型='" & Mtype & "'"
      If rs.State = 1 Then rs.Close
      rs.Open SQL, DBConn, adOpenKeyset, adLockOptimistic, adCmdText
      If rs.EOF Then
         rs.AddNew
         rs.Fields("部门名称").Value = Bumen
         rs.Fields("班组名称").Value = BanZu
         rs.Fields("表计类型").Value = Mtype
      End If
      rs.Fields("生产单位").Value = Flex.TextMatrix(i, 1)
      rs.Fields("生产周期").Value = Flex.TextMatrix(i, 2)
      rs.Fields("接收延时").Value = Flex.TextMatrix(i, 3)
      rs.Fields("加时累计").Value = IIf(Flex.TextMatrix(i, 4) = "√", True, False)
      rs.Update
      '班组产能表
      SQL = "Select * from 每日产能 where 部门名称='" & Bumen & "' and 班组名称='" & BanZu & "' and 表计类型='" & Mtype & "'"
      If rs.State = 1 Then rs.Close
      rs.Open SQL, DBConn, adOpenKeyset, adLockOptimistic, adCmdText
      If rs.EOF Then
         rs.AddNew
         rs.Fields("部门名称").Value = Bumen
         rs.Fields("班组名称").Value = BanZu
         rs.Fields("表计类型").Value = Mtype
      End If
      rs.Fields("小时产能").Value = Format(Val(Flex.TextMatrix(i, 1)) / Val(Flex.TextMatrix(i, 2)), "#####0")
      rs.Fields("基准").Value = IIf(Flex.TextMatrix(i, 5) = "√", True, False)
      rs.Update
      
    Next i
    MsgBox "修改完成", vbInformation, "提示"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -