|
- Sub 提交()
- Application.ScreenUpdating = False
- Dim n%, m%, x%, y%, k%
- On Error GoTo 100
- If Sheets("数据库").[A:A].Find([J3]) = [J3] Then
- MsgBox "此单已经保存过了!"
- Else
- 100:
- If [C4] = "" Or [C5] = "" Or [C6] = "" Or [J5] = "" Then MsgBox "信息没有填写完整,不能保存!": End
- m = Sheets("数据库").[A65536].End(xlUp).Row + 1
- With Sheets("数据库")
- .Cells(m, "A").Value = [J3] '编号
- .Cells(m, "B").Value = [J4] '开单日期
- .Cells(m, "C").Value = [C4] '客户
- .Cells(m, "D").Value = [C5] '品名
- .Cells(m, "E").Value = [C6] '料号
- .Cells(m, "F").Value = [J6] '成品规格
- .Cells(m, "G").Value = [J5] '生产数量
- .Cells(m, "H").Value = [B9] '封样单号
- .Cells(m, "I").Value = [E9] '刀模编号
- .Cells(m, "J").Value = [i10] '拼版数量
- .Cells(m, "K").Value = [B7] '材料1
- .Cells(m, "L").Value = [H7] '规格1
- .Cells(m, "M").Value = [F7] '供应商1
- .Cells(m, "N").Value = [J7] '材料数量
- .Cells(m, "O").Value = [B8] '材料2
- .Cells(m, "P").Value = [H8] '规格2
- .Cells(m, "Q").Value = [F8] '供应商2
- .Cells(m, "R").Value = [J8] '材料数量2
- .Cells(m, "S").Value = [H9] '加工车次
- .Cells(m, "T").Value = [B10] '包装方式
- .Cells(m, "U") = [F10] '包装数量
- .Cells(m, "V").Value = [J9] '交期
- .Cells(m, "W").Value = [B11] '物流方式
- End With
- MsgBox "提交成功!"
- End If
- ActiveWorkbook.Save
- Application.ScreenUpdating = True
- End Sub
- Sub 新增()
- Dim es As Range, k%, m$, i%
- Dim rng1 As Range, rng2 As Range
- On Error Resume Next
- Application.ScreenUpdating = False
- [J4] = Format(Now())
- Set es = Sheets("数据库").Columns(1).Find("*", , xlFormulas, , , xlPrevious)
- k = Format(Mid(es.Value, 6, 1), "00")
- m = Format(Mid(es.Value, 9, 3), "000")
- i = Format(Now, "mm")
- If Sheets("数据库").Range("A2") = "" Then [J3] = Format(Now, "yyyymm") & "001": Exit Sub
- If i > k Then
- [J3] = Format(Now, "yyyymm") & "001": End
- ElseIf i = k Then
- [J3] = Format(Now, "yyyymm") & Format(m + 1, "000")
- End If
- Sheets("指示单").Range("C4:H4,C5:H5,C6:H6,J5,J6,B7.D7,F7,H7,J7,B8,D8,F8,H8,J8,B9,E9,H9,J9,B10:D10,F10:J10,B11:J11") = ""
- Application.ScreenUpdating = True
- End Sub
- Sub 查询()
- Dim rg As Range, i%, j%
- Application.ScreenUpdating = False
- If IsNumeric([J3]) = False Then MsgBox "单号错误": Exit Sub
- Set rg = Sheets("数据库").Columns(1).Find([J3], , , 1)
- If rg Is Nothing Then MsgBox "单号格式不正确或查询不到单号数据!": Exit Sub
- With Sheets("数据库")
- i = .Columns(1).Find([J3], searchdirection:=xlNext).Row
- arr = .Range("a" & i & ":w" & i)
- [J4] = arr(1, 2) '开单日期
- [C4] = arr(1, 3) '客户
- [C5] = arr(1, 4) '品名
- [C6] = arr(1, 5) '料号
- [J6] = arr(1, 6) '成品规格
- [J5] = arr(1, 7) '生产数量
- [B9] = arr(1, 8) '封样单号
- [E9] = arr(1, 9) '刀模编号
- [i10] = arr(1, 10) '拼版数量
- [B7] = arr(1, 11) '材料1
- [H7] = arr(1, 12) '规格1
- [F7] = arr(1, 13) '供应商1
- [J7] = arr(1, 14) '材料数量
- [B8] = arr(1, 15) '材料2
- [H8] = arr(1, 16) '规格2
- [F8] = arr(1, 17) '供应商2
- [J8] = arr(1, 18) '材料数量2
- [H9] = arr(1, 19) '加工车次
- [B10] = arr(1, 20) '包装方式
- [F10] = arr(1, 21) '包装数量
- [J9] = arr(1, 22) '交期
- [B11] = arr(1, 23) '物流方式
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|