📄 frmgeneralpartplan1.frm
字号:
Width = 14535
_ExtentX = 25638
_ExtentY = 13785
_Version = 393216
HeadLines = 1
RowHeight = 17
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 1455
Left = 120
TabIndex = 5
Top = 480
Width = 14295
_ExtentX = 25215
_ExtentY = 2566
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 17
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "未加工任务"
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSDataGridLib.DataGrid DataGrid2
Height = 6255
Left = 120
TabIndex = 10
Top = 3240
Width = 14175
_ExtentX = 25003
_ExtentY = 11033
_Version = 393216
HeadLines = 1
RowHeight = 17
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "本月零件计划"
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "frmgeneralpartplan1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As New ADODB.Recordset
Dim rss As New ADODB.Recordset '向设备分配任务
Dim rs2 As New ADODB.Recordset '用来记录零件计划
Dim total As Integer
Dim myrs As New ADODB.Recordset '用来记录生成的零部件计划
Dim mark
Dim bool As Boolean
Dim c() As Integer
Dim conn As New ADODB.Connection
'根据零部件的工作号、机车型号,图号,计划个数、台分数量、生产类型查找以他为父件的零部件
Public Sub ff(workcodes As String, ordercodes As String, locomotivetypes As String, prodrawings As String, progroupamounts As Integer, groupamounts As Integer, note As String)
Dim sql As String
Dim bmrs As New ADODB.Recordset '用来记录生成的零部件计划
Dim find As Boolean '表示本计划再零部件计划表中是否存在
Dim find1 As Boolean '表示本记录的借用关系
Dim sch As New ADODB.Recordset
Dim ddrs As New ADODB.Recordset '他为查询大纲计划是否在调度模式计划中的记录集
Dim orderrs As New ADODB.Recordset
sql = "select * from t_spbillofmaterial" & _
" where locomotivetype='" & Trim$(locomotivetypes) & "'" & _
" and prodrawingnumber='" & Trim$(prodrawings) & "'" ' and productiontype in ('委外加工','自制','组装')"
bmrs.ActiveConnection = "dsn=dbw;uid=sa"
bmrs.CursorLocation = adUseClient
bmrs.CursorType = adOpenDynamic
bmrs.LockType = adLockOptimistic
bmrs.Source = sql
bmrs.Open
If bmrs.EOF And bmrs.BOF Then '若没有此部件的产品明细,则退出
bmrs.Close
Set bmrs = Nothing
' mark = mark + 1
Exit Sub
End If '否则转换成另不见计划
On Error Resume Next
bmrs.MoveFirst
Do Until bmrs.EOF '首先判断本条记录是否为调度模式计划若是则去掉
If bmrs("pargroupamount") <> 0 Then
If rs2.RecordCount <> 0 Then '首先判断零部件计划表中是否有本计划,若有则只增加其数量,否则增加一条新记录.
find = False
sql = "select * from t_spgeneralpartplan" & _
" where ordercode='" & Trim$(ordercodes) & "'and workcode='" & Trim$(workcodes) & "' and drawingnumber='" & Trim$(bmrs("pardrawingnumber")) & "'"
If sch.State = adStateOpen Then sch.Close
sch.ActiveConnection = "dsn=dbw;uid=sa"
sch.CursorLocation = adUseClient
sch.CursorType = adOpenKeyset
sch.LockType = adLockOptimistic
sch.Source = sql
sch.Open
If sch.RecordCount <> 0 Then find = True
End If
If find Then
sch("planquantity") = sch("planquantity") + progroupamounts * bmrs("pargroupamount") / groupamounts '父件计划个数*子件台分数量/父件台分数量
sch.Update
Else
Set orderrs = Nothing
orderrs.ActiveConnection = "dsn=dbw;uid=sa"
orderrs.CursorLocation = adUseClient
orderrs.CursorType = adOpenKeyset
orderrs.LockType = adLockOptimistic
orderrs.Source = "select * from t_suborder where ordercode='" & Trim$(ordercodes) & "'"
orderrs.Open
If orderrs.RecordCount <> 0 Then orderrs.MoveFirst
rs2.AddNew
rs2("workcode") = Trim$(workcodes)
rs2("locomotivetype") = CStr(Trim$(bmrs("locomotivetype")))
rs2("ordercode") = Trim$(ordercodes)
rs2("prodrawingnumber") = CStr(Trim$(bmrs("prodrawingnumber")))
rs2("drawingnumber") = CStr(Trim$(bmrs("pardrawingnumber")))
rs2("planquantity") = progroupamounts * bmrs("pargroupamount") / groupamounts '父件计划个数*子件台分数量/父件台分数量
rs2("pargroupamount") = Int(bmrs("pargroupamount"))
rs2("acceptdate") = CDate(orderrs("acceptdate"))
rs2("senddate") = CDate(orderrs("senddate"))
rs2("note") = Trim$(CStr(note))
rs2.Update
End If
myrs.AddNew
myrs("workcode") = Trim$(workcodes)
myrs("ordercode") = Trim$(ordercodes)
myrs("locomotivetype") = CStr(Trim$(bmrs("locomotivetype")))
myrs("drawingnumber") = CStr(Trim$(bmrs("pardrawingnumber")))
myrs("pargroupamount") = Int(bmrs("pargroupamount"))
myrs("planquantity") = progroupamounts * Int(bmrs("pargroupamount")) / groupamounts
myrs("note") = Trim$(CStr(note))
myrs.Update
End If
bmrs.MoveNext
Loop
bmrs.Close
Set bmrs = Nothing
End Sub
'一产品的工作号、机车型号、图号、计划台分为参数进行拆零函数
Public Sub Main1(workcodes As String, ordercodes As String, locomotivetypes As String, pardrawings As String, pargroupamounts As Integer, note As String) 'groupamounts As Integer
Dim sql As String
Dim rs1 As New ADODB.Recordset '用来记录生成的零部件计划
Dim find As Boolean '表示本计划再零部件计划表中是否存在
Dim find1 As Boolean '表示本记录的借用关系
Dim sch As New ADODB.Recordset
Dim orderrs As New ADODB.Recordset
'本条计划拆零按正常情况拆零
sql = "select * from t_spbillofmaterial where locomotivetype='" & Trim$(locomotivetypes) & "' and " & _
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -