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();
|
}
|
|
}
|
}
|
}
|
}
|