Dim sttr As String = ProjectPath & "纸板规格.ini" 'sttr = sttr.Replace("project\","") If FileSys.FileExists(sttr) = False Then messagebox.show(sttr) MessageBox.Show("没有纸板规格文件!") End If Dim str1 As String = Filesys.ReadAllText(sttr) ' ' Dim str2() As String = Str1.Split(vblf) Dim str3() As String Dim zf1,zf2 As String For i As Integer =0 To str2.length -1 str3 = str2(i).split("=") If str3.length = 2 Then If str3(0) = "size" Then zf1 = str3(1) ElseIf str3(0) = "lq" Then zf2 = str3(1) End If End If Next Dim sizes() As String = zf1.Split(",") 'Dim L As Double = 50 'Dim W As Double = 36 'Dim H As Double = 30 'Dim qty As Double = 40 Dim L As Double = args(0) Dim W As Double = args(1) Dim H As Double = args(2) Dim qty As Double = args(3) Dim YS As Integer = args(4) Dim KC,KG As Double 'KC = (L + W) * 2 + 3 'If KC <= 210 Then 'YS = 1 'Else 'KC = L + W +3 'YS = 2 'End If If YS = 1 Then KC = (L + W) * 2 + 3 ElseIf YS = 2 Then KC = L + W +3 End If KG = H + W + 0.3 + 0.3 Dim YX As String If H < 50 Then YX = CSTR(Round2(W/2+0.2, 1)) & "_" & CSTR(Round2(H, 0)) & "_" & CSTR(Round2(W/2+0.2, 1)) Else YX = CSTR(Round2(W/2+0.3, 1)) & "_" & CSTR(Round2(H, 0)) & "_" & CSTR(Round2(W/2+0.3, 1)) End If '--------------------------------------------------------------------------------- Dim CSIZE As Double Dim KAIS As Integer Dim del As Double = 0 Dim nu As Integer For N As Integer = 1 To 4 For i As Integer = 0 To sizes.length -1 If cdbl(sizes(i)) >= KG * N Then If n = 1 Then del = (cdbl(sizes(i)) - KG * N) / n CSIZE = cdbl(sizes(i)) KAIS = 1 If qty / n >= zf2 Then nu = 0 Else nu = 1 End If Else If qty / n >= zf2 Then If (cdbl(sizes(i)) - KG * N) / n < del Then del = (cdbl(sizes(i)) - KG * N) / n CSIZE = cdbl(sizes(i)) KAIS = n nu = 0 End If Else If nu = 1 Then If (cdbl(sizes(i)) - KG * N) / n < del Then del = (cdbl(sizes(i)) - KG * N) / n CSIZE = cdbl(sizes(i)) KAIS = n nu = 1 End If End If End If End If Exit For End If Next Next Dim zbsizes As String If qty * ys / KAIS < zf2 Then zbsizes = KC & "," & KG & "," & KAIS & "," & "压线: " & YX & "," & CSIZE & " * " & kc & " CM," & zf2 & "," & CSIZE & "," & kc Else zbsizes = KC & "," & KG & "," & KAIS & "," & "压线: " & YX & "," & CSIZE & " * " & kc & " CM," & qty * ys / KAIS & "," & CSIZE & "," & kc End If Return zbsizes