626 lines
19 KiB
Plaintext
626 lines
19 KiB
Plaintext
VERSION 5.00
|
|
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
|
|
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
|
|
Begin VB.Form frmBOM
|
|
Caption = "BOM"
|
|
ClientHeight = 5085
|
|
ClientLeft = 60
|
|
ClientTop = 450
|
|
ClientWidth = 9990
|
|
ControlBox = 0 'False
|
|
LinkTopic = "Form1"
|
|
ScaleHeight = 5085
|
|
ScaleWidth = 9990
|
|
StartUpPosition = 3 'Windows Default
|
|
Begin VB.CommandButton cmdReadSolidBOM
|
|
Caption = "Read SolidWorks BOM"
|
|
Height = 615
|
|
Left = 5850
|
|
TabIndex = 13
|
|
Top = 3240
|
|
Width = 1815
|
|
End
|
|
Begin VB.CommandButton cmdReadAltimaBOM
|
|
Caption = "Read Altima BOM"
|
|
Height = 615
|
|
Left = 4320
|
|
TabIndex = 10
|
|
Top = 3240
|
|
Width = 1515
|
|
End
|
|
Begin VB.ListBox lstStatus
|
|
Height = 1035
|
|
Left = 540
|
|
TabIndex = 9
|
|
Top = 3870
|
|
Width = 9405
|
|
End
|
|
Begin VB.CommandButton cmdShow
|
|
Caption = "Show Loaded BOM"
|
|
Height = 615
|
|
Left = 2670
|
|
TabIndex = 8
|
|
Top = 3240
|
|
Width = 1635
|
|
End
|
|
Begin VB.CommandButton cmdClearBOM
|
|
Caption = "Clear BOM"
|
|
Height = 615
|
|
Left = 1620
|
|
TabIndex = 7
|
|
Top = 3240
|
|
Width = 1035
|
|
End
|
|
Begin VB.CommandButton cmdHide
|
|
Caption = "Close"
|
|
Height = 345
|
|
Left = 8250
|
|
TabIndex = 5
|
|
Top = 60
|
|
Width = 1635
|
|
End
|
|
Begin VB.TextBox txtGood
|
|
Height = 255
|
|
Left = 480
|
|
TabIndex = 4
|
|
Top = 2880
|
|
Width = 1215
|
|
End
|
|
Begin VB.CommandButton cmdReadBOM
|
|
Caption = "Read BOM"
|
|
Height = 615
|
|
Left = 540
|
|
TabIndex = 3
|
|
Top = 3240
|
|
Width = 1065
|
|
End
|
|
Begin VB.TextBox txtBOM
|
|
Height = 255
|
|
Left = 1200
|
|
TabIndex = 2
|
|
Text = "J:\Broyles\8235482.bom.1"
|
|
ToolTipText = "Full path and file name"
|
|
Top = 480
|
|
Width = 8745
|
|
End
|
|
Begin MSDataGridLib.DataGrid DataGrid1
|
|
Bindings = "Cmdproc-5.frx":0000
|
|
Height = 1575
|
|
Left = 480
|
|
TabIndex = 1
|
|
Top = 840
|
|
Width = 7155
|
|
_ExtentX = 12621
|
|
_ExtentY = 2778
|
|
_Version = 393216
|
|
HeadLines = 1
|
|
RowHeight = 15
|
|
FormatLocked = -1 'True
|
|
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 400
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 400
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
ColumnCount = 5
|
|
BeginProperty Column00
|
|
DataField = "WASM#"
|
|
Caption = "WASM#"
|
|
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
|
|
Type = 0
|
|
Format = ""
|
|
HaveTrueFalseNull= 0
|
|
FirstDayOfWeek = 0
|
|
FirstWeekOfYear = 0
|
|
LCID = 1033
|
|
SubFormatType = 0
|
|
EndProperty
|
|
EndProperty
|
|
BeginProperty Column01
|
|
DataField = "WASMR"
|
|
Caption = "WASMR"
|
|
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
|
|
Type = 0
|
|
Format = ""
|
|
HaveTrueFalseNull= 0
|
|
FirstDayOfWeek = 0
|
|
FirstWeekOfYear = 0
|
|
LCID = 1033
|
|
SubFormatType = 0
|
|
EndProperty
|
|
EndProperty
|
|
BeginProperty Column02
|
|
DataField = "WCMP#"
|
|
Caption = "WCMP#"
|
|
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
|
|
Type = 0
|
|
Format = ""
|
|
HaveTrueFalseNull= 0
|
|
FirstDayOfWeek = 0
|
|
FirstWeekOfYear = 0
|
|
LCID = 1033
|
|
SubFormatType = 0
|
|
EndProperty
|
|
EndProperty
|
|
BeginProperty Column03
|
|
DataField = "WQTY"
|
|
Caption = "WQTY"
|
|
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
|
|
Type = 0
|
|
Format = ""
|
|
HaveTrueFalseNull= 0
|
|
FirstDayOfWeek = 0
|
|
FirstWeekOfYear = 0
|
|
LCID = 1033
|
|
SubFormatType = 0
|
|
EndProperty
|
|
EndProperty
|
|
BeginProperty Column04
|
|
DataField = "WENTD"
|
|
Caption = "WENTD"
|
|
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
|
|
Type = 0
|
|
Format = ""
|
|
HaveTrueFalseNull= 0
|
|
FirstDayOfWeek = 0
|
|
FirstWeekOfYear = 0
|
|
LCID = 1033
|
|
SubFormatType = 0
|
|
EndProperty
|
|
EndProperty
|
|
SplitCount = 1
|
|
BeginProperty Split0
|
|
BeginProperty Column00
|
|
EndProperty
|
|
BeginProperty Column01
|
|
ColumnWidth = 645.165
|
|
EndProperty
|
|
BeginProperty Column02
|
|
EndProperty
|
|
BeginProperty Column03
|
|
ColumnWidth = 1065.26
|
|
EndProperty
|
|
BeginProperty Column04
|
|
ColumnWidth = 1590.236
|
|
EndProperty
|
|
EndProperty
|
|
End
|
|
Begin MSAdodcLib.Adodc Adodc1
|
|
Height = 330
|
|
Left = 480
|
|
Top = 2460
|
|
Width = 7155
|
|
_ExtentX = 12621
|
|
_ExtentY = 582
|
|
ConnectMode = 0
|
|
CursorLocation = 3
|
|
IsolationLevel = -1
|
|
ConnectionTimeout= 15
|
|
CommandTimeout = 30
|
|
CursorType = 3
|
|
LockType = 3
|
|
CommandType = 2
|
|
CursorOptions = 0
|
|
CacheSize = 50
|
|
MaxRecords = 0
|
|
BOFAction = 0
|
|
EOFAction = 0
|
|
ConnectStringType= 3
|
|
Appearance = 1
|
|
BackColor = -2147483643
|
|
ForeColor = -2147483640
|
|
Orientation = 0
|
|
Enabled = -1
|
|
Connect = "DSN=ODBCrms"
|
|
OLEDBString = ""
|
|
OLEDBFile = ""
|
|
DataSourceName = "ODBCrms"
|
|
OtherAttributes = ""
|
|
UserName = "EGNETLINK"
|
|
Password = "DRAWINGS"
|
|
RecordSource = "EGBWP1A0"
|
|
Caption = "Adodc1"
|
|
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
|
|
Name = "MS Sans Serif"
|
|
Size = 8.25
|
|
Charset = 0
|
|
Weight = 400
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
_Version = 393216
|
|
End
|
|
Begin VB.TextBox txtAssembly
|
|
Height = 285
|
|
Left = 1200
|
|
TabIndex = 0
|
|
Text = "82354821"
|
|
ToolTipText = "Must be 8 characters PN and rev"
|
|
Top = 120
|
|
Width = 3255
|
|
End
|
|
Begin VB.Label Label2
|
|
Caption = "BOM File"
|
|
Height = 255
|
|
Left = 450
|
|
TabIndex = 12
|
|
Top = 480
|
|
Width = 855
|
|
End
|
|
Begin VB.Label Label1
|
|
Caption = "Assembly"
|
|
Height = 255
|
|
Left = 450
|
|
TabIndex = 11
|
|
Top = 120
|
|
Width = 855
|
|
End
|
|
Begin VB.Label lblStat
|
|
Height = 195
|
|
Left = 2340
|
|
TabIndex = 6
|
|
Top = 3000
|
|
Width = 4635
|
|
End
|
|
End
|
|
Attribute VB_Name = "frmBOM"
|
|
Attribute VB_GlobalNameSpace = False
|
|
Attribute VB_Creatable = False
|
|
Attribute VB_PredeclaredId = True
|
|
Attribute VB_Exposed = False
|
|
|
|
Public Sub cmdClearBOM_Click()
|
|
Dim Rcds As Variant
|
|
Dim Parms As Variant
|
|
|
|
If cmdClearBOM.Tag <> "X" Then
|
|
cmdClearBOM.Tag = "X"
|
|
Set Links = New ClearBOM
|
|
ass$ = left(txtAssembly, 7)
|
|
rev$ = right(left(Trim(txtAssembly) + " ", 8), 1)
|
|
loglist ("StartClear - " + ass$ + " " + rev$)
|
|
'
|
|
p1$ = left$(ass$ + Space$(15), 15) 'partnumber to get
|
|
P2$ = left$(rev$ + Space$(1), 1) 'filename
|
|
p3$ = Space$(2) 'status
|
|
'
|
|
Parms = Array(p1$, P2$, p3$)
|
|
Links.cm_ACTIVEXSDK_CUSTINS.Execute Rcds, Parms, adCmdText
|
|
retcd$ = Links.cm_ACTIVEXSDK_CUSTINS.Parameters(2).value
|
|
' On Error GoTo BadCBom
|
|
''
|
|
'' Clear out the old records
|
|
''
|
|
' loglist ("clear rec " + "(([WASM#] = '" + ass$ + "') and ([WASMR] = '" + rev$ + "'))")
|
|
' Adodc1.Recordset.Filter = "(([WASM#] = '" + ass$ + "') and ([WASMR] = '" + rev$ + "'))"
|
|
' ix = 1
|
|
' Adodc1.Recordset.MoveFirst
|
|
' Do While Adodc1.Recordset.RecordCount > 0
|
|
' loglist "deleting rec rcnt: " + Str(ix)
|
|
' If ((UCase(Trim(Adodc1.Recordset![WASM#])) = Trim(UCase(ass$))) And (UCase(Trim(Adodc1.Recordset![WASMR])) = Trim(UCase(rev$)))) Then
|
|
' Adodc1.Recordset.Delete
|
|
' Adodc1.Recordset.MoveFirst
|
|
' Else
|
|
' Adodc1.Recordset.MoveNext
|
|
' End If
|
|
' ix = ix + 1
|
|
' If Adodc1.Recordset.EOF Then Exit Do
|
|
' Loop
|
|
loglist "clear done! RC=" + retcd$
|
|
cmdClearBOM.Tag = ""
|
|
Else
|
|
loglist "clear FAILED! BOM BUSY"
|
|
End If
|
|
'
|
|
Exit Sub
|
|
BadCBom:
|
|
Resume Next
|
|
' Adodc1.Refresh
|
|
End Sub
|
|
|
|
Private Sub cmdHide_Click()
|
|
frmBOM.Hide
|
|
End Sub
|
|
|
|
Public Sub cmdReadAltimaBOM_Click()
|
|
If cmdReadAltimaBOM.Tag <> "X" Then
|
|
cmdReadAltimaBOM.Tag = "X"
|
|
|
|
fln$ = txtBOM
|
|
ass$ = left(txtAssembly, 7)
|
|
rev$ = right(left(Trim(txtAssembly) + " ", 8), 1)
|
|
goodread = 0
|
|
loglist ("StartRead alt - " + ass$)
|
|
loglist (" from file - " + fln$)
|
|
' lblStat.Caption = "StartRead"
|
|
If ExistsNew(fln$) Then
|
|
On Error GoTo BadAltBom
|
|
'
|
|
' parse the file
|
|
'
|
|
loglist "Parsing file " + fln$
|
|
fl = FreeFile
|
|
BomRecs = 0
|
|
Open fln$ For Input As #fl
|
|
'
|
|
' skip first two records
|
|
'
|
|
Line Input #fl, a$ ' column headers
|
|
Line Input #fl, a$ ' blank line
|
|
|
|
flstate = 0
|
|
Do While Not EOF(fl)
|
|
Line Input #fl, a$
|
|
ax$ = UCase(a$)
|
|
If Trim(ax$) <> "" Then
|
|
Call PARSE(ax$, qty$, ",", RC%): qty$ = ReplaceStr(qty$, Chr$(34), "")
|
|
Call PARSE(ax$, Pn$, ",", RC%): Pn$ = left(ReplaceStr(Pn$, Chr$(34), ""), 7)
|
|
|
|
If Pn$ <> "" Then
|
|
'Pn$ = prt$
|
|
loglist "Adding rec:" + ass$ + Pn$
|
|
qut$ = Format(qty, "#.0")
|
|
Adodc1.Recordset.AddNew
|
|
Adodc1.Recordset![WASM#] = UCase(ass$)
|
|
Adodc1.Recordset!WASMR = UCase(rev$)
|
|
Adodc1.Recordset![WCMP#] = Pn$
|
|
Adodc1.Recordset!WQTY = LPad(Format(Val(qut$), "####.000"), 8)
|
|
Adodc1.Recordset!WENTD = Format(Now, "YYYYMMDDHHNNSS")
|
|
Adodc1.Recordset.Update
|
|
BomRecs = BomRecs + 1
|
|
End If
|
|
End If
|
|
Loop
|
|
Close #fl
|
|
loglist "Done!"
|
|
If BomRecs = 0 Then
|
|
goodread = 1 ' bad bom
|
|
loglist "BAD altBOM No Records added"
|
|
End If
|
|
Else
|
|
loglist "BAD altBOM Didn't find BOM - " + fln$
|
|
goodread = 2 ' No bom
|
|
End If
|
|
txtGood.Text = goodread
|
|
txtBOM = ""
|
|
txtAssembly = ""
|
|
Adodc1.Refresh
|
|
cmdReadAltimaBOM.Tag = ""
|
|
Else
|
|
loglist "altBOM BUSY"
|
|
End If
|
|
On Error GoTo 0
|
|
AltBOMDIE:
|
|
Exit Sub
|
|
BadAltBom:
|
|
txtGood.Text = 1 ' bad bom
|
|
txtBOM = ""
|
|
txtAssembly = ""
|
|
loglist "BAD altBOM On ERROR Kick out"
|
|
' Adodc1.Refresh
|
|
cmdReadAltimaBOM.Tag = ""
|
|
Resume AltBOMDIE
|
|
End Sub
|
|
Public Sub cmdReadSolidBOM_Click()
|
|
Call ReadSolidBOM
|
|
End Sub
|
|
|
|
Public Sub ReadSolidBOM()
|
|
If cmdReadSolidBOM.Tag <> "X" Then
|
|
cmdReadSolidBOM.Tag = "X"
|
|
|
|
fln$ = txtBOM
|
|
ass$ = left(txtAssembly, 7)
|
|
rev$ = right(left(Trim(txtAssembly) + " ", 8), 1)
|
|
goodread = 0
|
|
loglist ("StartRead SW - " + ass$ + " " + rev$)
|
|
loglist (" from file - " + fln$)
|
|
|
|
' lblStat.Caption = "StartRead"
|
|
If ExistsNew(fln$) Then
|
|
'
|
|
' parse the file
|
|
'
|
|
' Tab Delimited ignore first line
|
|
'
|
|
' ItemNo<TAB>PartNo<TAB>Qty<TAB>Descr
|
|
'
|
|
loglist "File Exists "
|
|
fl = FreeFile
|
|
BomRecs = 0
|
|
Open fln$ For Input As #fl
|
|
flstate = 0
|
|
If Not EOF(fl) Then
|
|
bad = False
|
|
For ix = 1 To Len(a$)
|
|
b = Asc(Mid(a$, ix, 1))
|
|
If b >= 255 Then
|
|
bad = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
Close fl
|
|
If bad Then
|
|
goodread = 1 'bad bom
|
|
txtGood.Text = goodread
|
|
txtBOM = ""
|
|
txtAssembly = ""
|
|
loglist "BOM BAD"
|
|
Else
|
|
Open fln$ For Input As #fl
|
|
Do While Not EOF(fl)
|
|
Line Input #fl, a$
|
|
ax$ = UCase(a$)
|
|
loglist "Number of Tabs in rec: " + Str(Howmany%(ax$, Chr(9)))
|
|
If left(ax$, 4) = "ITEM" Then ax$ = "" 'ignore heading
|
|
If Trim(ax$) <> "" Then
|
|
Call PARSE(ax$, itm$, Chr(9), rcx%)
|
|
Call PARSE(ax$, Pn$, Chr(9), rcx%)
|
|
Call PARSE(ax$, quty$, Chr(9), rcx%)
|
|
loglist "Adding rec:" + ass$ + Pn$
|
|
qut$ = Format(Val(quty$), "#.0")
|
|
Adodc1.Recordset.AddNew
|
|
Adodc1.Recordset![WASM#] = UCase(ass$)
|
|
loglist UCase(ass$)
|
|
Adodc1.Recordset!WASMR = UCase(rev$)
|
|
loglist UCase(rev$)
|
|
Adodc1.Recordset![WCMP#] = Pn$
|
|
loglist Pn$
|
|
Adodc1.Recordset!WQTY = LPad(Format(Val(qut$), "####.000"), 8)
|
|
loglist LPad(Format(Val(qut$), "####.000"), 8)
|
|
Adodc1.Recordset!WENTD = Format(Now, "YYYYMMDDHHNNSS")
|
|
loglist Format(Now, "YYYYMMDDHHNNSS")
|
|
Adodc1.Recordset.Update
|
|
loglist "----------"
|
|
BomRecs = BomRecs + 1
|
|
End If
|
|
Loop
|
|
Close #fl
|
|
End If
|
|
End If
|
|
txtGood.Text = goodread
|
|
txtBOM = ""
|
|
txtAssembly = ""
|
|
Adodc1.Refresh
|
|
loglist "----------complete----------"
|
|
cmdReadSolidBOM.Tag = ""
|
|
Else
|
|
loglist "BOM BUSY"
|
|
End If
|
|
On Error GoTo 0
|
|
End Sub
|
|
|
|
Public Sub cmdReadBOM_Click()
|
|
If cmdReadBOM.Tag <> "X" Then
|
|
cmdReadBOM.Tag = "X"
|
|
|
|
fln$ = txtBOM
|
|
ass$ = left(txtAssembly, 7)
|
|
rev$ = right(left(Trim(txtAssembly) + " ", 8), 1)
|
|
goodread = 0
|
|
loglist ("StartRead - " + ass$)
|
|
' lblStat.Caption = "StartRead"
|
|
If ExistsNew(fln$) Then
|
|
On Error GoTo BadBom
|
|
'
|
|
' parse the file
|
|
'
|
|
' 1 Sub-Assembly 8241378
|
|
'--qty-|----descr----|---PN--
|
|
'123456789012345678901234567890
|
|
' 12345678901234
|
|
' 1-6 8-20 22->
|
|
' left(ax$,6):mid(ax$,8,24):mid(ax$,22)
|
|
'
|
|
loglist "Parsing file " + fln$
|
|
fl = FreeFile
|
|
BomRecs = 0
|
|
Open fln$ For Input As #fl
|
|
flstate = 0
|
|
Do While Not EOF(fl)
|
|
Line Input #fl, a$
|
|
ax$ = UCase(a$)
|
|
Select Case flstate
|
|
Case 0
|
|
If InStr(ax$, "ASSEMBLY") <> 0 Then
|
|
flstate = 1
|
|
End If
|
|
Case 1
|
|
If Trim(ax$) = "" Then
|
|
flstate = 2
|
|
Else
|
|
dsc$ = Trim(Mid(ax$, 8, 14)): prt$ = Mid(ax$, 22)
|
|
qty = Val(Trim(left(ax$, 6)))
|
|
Pn$ = ""
|
|
|
|
d = 0
|
|
If (dsc$ <> "PART") And (dsc$ <> "SUB-ASSEMBLY") Then
|
|
loglist "BAD BOM dsc wasn't right - " + dsc$
|
|
goodread = 1 ' bad bom
|
|
flstate = 2
|
|
Else
|
|
Pn$ = prt$
|
|
loglist "Adding rec:" + ass$ + Pn$
|
|
qut$ = Format(qty, "#.0")
|
|
Adodc1.Recordset.AddNew
|
|
Adodc1.Recordset![WASM#] = UCase(ass$)
|
|
Adodc1.Recordset!WASMR = UCase(rev$)
|
|
Adodc1.Recordset![WCMP#] = Pn$
|
|
Adodc1.Recordset!WQTY = LPad(Format(Val(qut$), "####.000"), 8)
|
|
Adodc1.Recordset!WENTD = Format(Now, "YYYYMMDDHHNNSS")
|
|
Adodc1.Recordset.Update
|
|
BomRecs = BomRecs + 1
|
|
End If
|
|
End If
|
|
Case Else
|
|
Exit Do
|
|
End Select
|
|
Loop
|
|
Close #fl
|
|
loglist "Done!"
|
|
If BomRecs = 0 Then
|
|
goodread = 1 ' bad bom
|
|
loglist "BAD BOM No Records added"
|
|
End If
|
|
Else
|
|
loglist "BAD BOM Didn't find BOM - " + fln$
|
|
goodread = 2 ' No bom
|
|
End If
|
|
txtGood.Text = goodread
|
|
txtBOM = ""
|
|
txtAssembly = ""
|
|
Adodc1.Refresh
|
|
cmdReadBOM.Tag = ""
|
|
Else
|
|
loglist "BOM BUSY"
|
|
End If
|
|
On Error GoTo 0
|
|
BOMDIE:
|
|
Exit Sub
|
|
BadBom:
|
|
txtGood.Text = 1 ' bad bom
|
|
txtBOM = ""
|
|
txtAssembly = ""
|
|
loglist "BAD BOM On ERROR Kick out"
|
|
' Adodc1.Refresh
|
|
cmdReadBOM.Tag = ""
|
|
Resume BOMDIE
|
|
End Sub
|
|
|
|
Private Sub cmdShow_Click()
|
|
ass$ = left(txtAssembly, 7)
|
|
rev$ = right(left(Trim(txtAssembly) + " ", 8), 1)
|
|
loglist "Start Display of BOM - " + ass$ + " " + rev$
|
|
On Error Resume Next
|
|
'
|
|
' Clear out the old records
|
|
'
|
|
loglist "clear rec " + "(([WASM#] = '" + ass$ + "') and ([WASMR] = '" + rev$ + "'))"
|
|
Adodc1.Recordset.Filter = "(([WASM#] = '" + ass$ + "') and ([WASMR] = '" + rev$ + "'))"
|
|
|
|
End Sub
|
|
|
|
Private Sub loglist(xxx$)
|
|
lblStat.Caption = xxx$
|
|
lstStatus.AddItem xxx$
|
|
While lstStatus.ListCount > 600
|
|
lstStatus.RemoveItem (0)
|
|
Wend
|
|
|
|
End Sub
|
|
|