You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
3.8 KiB
110 lines
3.8 KiB
using System;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PaintingPC
|
|
{
|
|
public partial class FrmChangeColor : Form
|
|
{
|
|
string barCode = "",stationNo="";
|
|
|
|
public FrmChangeColor(string code,string no)
|
|
{
|
|
InitializeComponent();
|
|
barCode = code;
|
|
stationNo= no;
|
|
}
|
|
|
|
private void FrmChangeColor_Load(object sender, EventArgs e)
|
|
{
|
|
#region 加载颜色
|
|
|
|
//int drow = 0, dcol = 4; //行,列
|
|
int drow = 0, dcol = 4; //行,列
|
|
|
|
DataTable dt = Function.GetAllColor();
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
drow = Convert.ToInt32(Math.Ceiling((double)dt.Rows.Count / dcol));
|
|
RadioButton[] rbs = new RadioButton[dcol];
|
|
string[] dstr = new string[dt.Rows.Count];
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
//dstr[i] = dt.Rows[i]["Des"].ToString() + "," + dt.Rows[i]["ColorCode"].ToString() + "," + dt.Rows[i]["ColorNo"].ToString();
|
|
dstr[i] = dt.Rows[i]["Des"] + "," + Function.GetBcColorByNo(dt.Rows[i]["ColorNo"].ToString()) + "," + dt.Rows[i]["ColorNo"];
|
|
}
|
|
|
|
for (int i = 0; i < dcol; i++) //列
|
|
{
|
|
for (int j = 0; j < drow; j++) //行
|
|
{
|
|
rbs[i] = new RadioButton();
|
|
if ((i + dcol * j) < dstr.Length)
|
|
{
|
|
rbs[i].Text = dstr[i + dcol * j].ToString();
|
|
//rbs[i].Font = new Font(rbs[i].Font.FontFamily, 12, FontStyle.Bold);
|
|
//rbs[i].Size = new Size(300, 30);
|
|
//rbs[i].Location = new Point(20 + i * (rbs[i].Size.Width + 15), 5 + j * (rbs[i].Size.Height + 5));
|
|
rbs[i].Font = new Font(rbs[i].Font.FontFamily, 20, FontStyle.Bold);
|
|
rbs[i].Size = new Size(300, 35);
|
|
rbs[i].Location = new Point(20 + i * (rbs[i].Size.Width + 15), 5 + j * (rbs[i].Size.Height + 30));
|
|
rbs[i].BackColor = Color.Transparent;
|
|
rbs[i].TextAlign = ContentAlignment.MiddleLeft;
|
|
panel2.Controls.Add(rbs[i]);
|
|
rbs[i].Click += new EventHandler(radioButton_Click);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
private void radioButton_Click(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = sender as RadioButton;
|
|
//rb.Select();
|
|
rb.Checked = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnBack_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 确定按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (Control c in panel2.Controls)
|
|
{
|
|
RadioButton rbn = c as RadioButton;
|
|
if (rbn.Checked)
|
|
{
|
|
FrmFirstCheck.ColorName = rbn.Text;
|
|
FrmSecondCheck.ColorName = rbn.Text;
|
|
|
|
string partName;
|
|
Function.GetInfoByStockNo(barCode.Substring(0, 10), "", out partName);
|
|
|
|
string resultStr = rbn.Text + "," + partName;
|
|
|
|
Function.SaveChangColor(barCode,resultStr, stationNo);
|
|
}
|
|
}
|
|
|
|
this.Close();
|
|
}
|
|
|
|
}
|
|
}
|
|
|