schangxiang@126.com
2025-09-01 63336945cec2801e5582c0d457906ee82066ea31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace WMS.UI.WORK
{
    public partial class HandInStock : Form
    {
        private static HandInStock instance;
        public HandInStock()
        {
            InitializeComponent();
 
        }
 
        public static HandInStock create()
        {
            if (instance == null)
            {
                instance = new HandInStock();
            }
            return instance;
 
        }
 
        private void HandInStock_Load(object sender, EventArgs e)
        {
            comboBox_type.SelectedIndex = 0;
            comboBox_emptyType.SelectedIndex = 0;
            comboBox_emptyType.SelectedIndex = 0;
            textBox_materialCode.Enabled = false;
            textBox_serialNumber.Enabled = false;
            comboBox_station.SelectedIndex = 0;
        }
 
        private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            SolidBrush b = new SolidBrush(this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor);
            e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), this.dataGridView1.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);
 
        }
 
        private void textBox_serialNumber_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                int index = this.dataGridView1.Rows.Add();
                this.dataGridView1.Rows[index].Cells[0].Value = textBox_serialNumber.Text.Trim();
            }
        }
 
        private void button_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
 
        private void comboBox_type_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox_type.SelectedIndex == 0)
            {
                comboBox_emptyType.Enabled = true;
                textBox_materialCode.Enabled = false;
                textBox_serialNumber.Enabled = false;
            }
            else
            {
                comboBox_emptyType.Enabled = false;
                textBox_materialCode.Enabled = true;
                textBox_serialNumber.Enabled = true;
            }
        }
 
        private void button_confirm_Click(object sender, EventArgs e)
        {
            if (comboBox_type.SelectedIndex != 0)
            {
                if (textBox_materialCode.Text.Trim() == null)
                {
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "物料入库,物料编号不可为空");
                    ms.Show();
                }
                if (dataGridView1.Rows.Count==0)
                {
                     WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "物料入库,流水号不可为空");
                    ms.Show();
                }
 
            }
        }
    }
}