Dim cz As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim jjk As WinForm.TextBox = e.Form.Controls("TextBox6")
Dim fs As WinForm.ComboBox = e.Form.Controls("ComboBox2")
If cz.text = "" Then
MessageBox.show("请先选择材质","提示")
Else
If fs.text = "横裁" Then
Dim maxc As Integer
Dim maxk As Integer
maxc = DataTables("规格需求").Compute("max(长)","材质 ='" & cz.text & "' and 剩余欠量 > 0 and 不套裁 = false")
maxk = DataTables("规格需求").Compute("max(宽)","长 = "& maxc &" And 剩余欠量 > 0 And 不套裁 = false")
Dim dc As DataRow = DataTables("规格需求").find("长 = "& maxc &" And 宽 = "& maxk &"")
Dim xq As Integer = dc("剩余欠量")
Dim hengchu1 As Integer = Int(1200 / (maxk + 4))
Dim Ary() As Integer = {xq,hengchu1}
Array.Sort(ary)
Dim sas As Integer = ary(0)
Dim i As Integer
For i = 1 To sas
Dim x1 As Integer = maxc / 3.5
Dim x2 As Integer = maxk / 3.5
Dim wzx As Integer = 5 + (i - 1) * (maxc + 1)
Dim Panel1 As WinForm.Panel
Panel1 = e.Form.CreateControl("Panel1", ControlTypeEnum.Panel)
Panel1.SetBounds(wzx, 5, x2, x1)
e.Form.Controls("SplitContainer1").Panel2.AddControl(Panel1)
e.Form.Controls("Panel1").BackColor = Color.Orangered
Dim lbl As WinForm.Label
lbl = e.Form.CreateControl("Label1", ControlTypeEnum.Label)
Dim gg1 As String = maxc & "*" & maxk
lbl.Text = gg1
lbl.Left = x2 / 2 - 30
lbl.Top = x1 / 2 - 15
e.Form.Controls("Panel1").AddControl(lbl)
Dim nd As DataRow = DataTables("临时").addnew()
nd("规格编号") = dc("规格编号")
nd("数量") = 1
Dim syh1 As Integer = 1
Next
End If
End If