-- 作者:igewcw
-- 发布时间:2023/2/20 13:24:00
-- 请教,如何将按类别自动生成编号的类别编号用字母代替?
各位老师,您好,如下代码如何修改可以将工艺分类的编号由数字改为字母?如下图所示,正常模切编号是21,MYLAR类编号是01,生成编号就是21010001,但是如果我将模切编号改为MQ,就会出错。
此主题相关图片如下:qq图片20230220132159.png If Tables("成品信息表").Current.IsNull("项目编号") = False Then messagebox.show("请先删除现有编号,才能自动生成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information) ReturnEnd IfDim nms() As String = {"工艺分类", "工艺特征"}Dim bh As IntegerFor Each nm As String In nms Dim dr As DataRow = DataTables("成品编码原则").Find(nm & " = \'" & e.Form.Controls(nm).Value & "\'") If dr IsNot Nothing Then bh = bh & dr(nm & "编号") Else If nm = "工艺分类" OrElse nm = "工艺特征" Then bh = bh & "1" dr(nm & "编号") = "1" Else bh = bh & "01" dr(nm & "编号") = "01" End If End IfNextDim drs As List(Of DataRow) = DataTables("成品信息表").Select("项目编号 Like \'" & bh & "*\'", "项目编号")If drs.count = 00 Then Tables("成品信息表").current("项目编号") = bh & "0001"Else Dim lat As String = drs(drs.count - 1)("项目编号") lat = lat.SubString(lat.length - 3) Dim Inx As Integer = val(lat) + 1 Tables("成品信息表").current("项目编号") = bh & Format(Inx, "0000")End If
|