using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace SCM
|
{
|
public partial class Gy_BadReasonList : Form
|
{
|
public Gy_BadReasonList()
|
{
|
BlDic = new Dictionary<string, int>();
|
InitializeComponent();
|
textBox2.Text = "ÎïÁÏ´úÂë";
|
textBox3.Text = "ÎïÁÏÃû³Æ";
|
textBox4.Text = "¹æ¸ñÐͺÅ";
|
textBox5.Text = "¼ÆÁ¿µ¥Î»";
|
oWeb.Url = SCM.ClsPub1.WEBSURL;
|
AddButton();
|
}
|
|
public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
|
private static Dictionary<string, int> BlDic;
|
public int ISOK = 0;
|
public string sSourceTypeName = "";
|
|
private void Gy_BadReasonList_Load(object sender, EventArgs e)
|
{
|
oWeb.Url = SCM.ClsPub1.WEBSURL;
|
}
|
|
|
public string blStr = string.Empty;//²»Á¼ÔÒò
|
public string blId = string.Empty;//²»Á¼ÔÒòid
|
|
private void cmdHOK_Click(object sender, EventArgs e)
|
{
|
int a = 0;
|
blStr = string.Empty;
|
blId = string.Empty;
|
foreach (var item in BlDic)
|
{
|
blStr += a == 0 ? item.Key : ";" + item.Key;
|
blId += a == 0 ? item.Value.ToString() : ";" + item.Value;
|
a++;
|
}
|
if (string.IsNullOrEmpty(blStr))
|
{
|
MessageBox.Show("ÇëÑ¡Ôñ²»Á¼ÔÒòºóÌá½»", "´íÎó", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
return;
|
}
|
//if (sSourceTypeName == "Éú²ú¶©µ¥")
|
//{
|
if (DBUtility.ClsPub.isDoule(txtHBadQty.Text) <= 0)
|
{
|
MessageBox.Show("ÇëÊäÈë²»Á¼Ã×Êý£¡", "´íÎó", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
txtHBadQty.Focus();
|
return;
|
}
|
//}
|
ISOK = 1;
|
this.Visible = false;
|
}
|
|
private void cmdCancel_Click(object sender, EventArgs e)
|
{
|
txtHBadReason.Text = "";
|
ISOK = 0;
|
this.Visible = false;
|
}
|
|
private void cmdHClear_Click(object sender, EventArgs e)
|
{
|
txtHBadReason.Text = string.Empty;
|
BlDic = new Dictionary<string, int>();
|
}
|
|
/// <summary>
|
/// ¶¯Ì¬¼ÓÔØ²»Á¼ÔÒò
|
/// </summary>
|
public void AddButton()
|
{
|
|
DataSet ds = oWeb.getDataSetBySQL("select top 100 HIteMID,HName from Gy_BadReason order by hnumber ", "Gy_BadReason", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
return;
|
}
|
DataTable dataTable = ds.Tables[0];
|
for (int i = 0; i < dataTable.Rows.Count; i++)
|
{
|
Button button = new Button();
|
button.Location = new System.Drawing.Point(25, 40);
|
button.Name = "btn";
|
button.Size = new System.Drawing.Size(120, 80);
|
button.TabIndex = 0;
|
button.Tag = dataTable.Rows[i]["HIteMID"].ToString();
|
button.TextAlign = ContentAlignment.MiddleCenter;
|
button.Text = dataTable.Rows[i]["HName"].ToString();
|
button.BackColor = Color.Gray;
|
button.FlatStyle = FlatStyle.Flat;
|
button.FlatAppearance.BorderSize = 0;
|
button.BackColor = Color.Gainsboro;
|
button.Click += new EventHandler(Btn_Click);//ʹÓÃʼþº¯Êý¾ä±úÖ¸ÏòÒ»¸ö¾ßÌåµÄº¯Êý
|
flowLayoutPanel1.Controls.Add(button);
|
}
|
label6.Text = label6.Text + sSourceTypeName;
|
}
|
|
|
/// <summary>
|
/// ²»Á¼ÎïÁϵã»÷ʼþ
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void Btn_Click(object sender, EventArgs e)
|
{
|
Button btn = (Button)sender;//»ñÈ¡±»µã»÷µÄ¿Ø¼þ,°´Å¥
|
if (BlDic.ContainsKey(btn.Text))
|
{
|
BlDic.Remove(btn.Text);
|
}
|
else
|
{
|
BlDic.Add(btn.Text, int.Parse(btn.Tag.ToString()));
|
}
|
SetBlText();
|
}
|
|
/// <summary>
|
/// Îı¾¿ò¸³Öµ
|
/// </summary>
|
private void SetBlText()
|
{
|
int a = 0;
|
txtHBadReason.Text = string.Empty;
|
foreach (var item in BlDic)
|
{
|
txtHBadReason.Text += a == 0 ? item.Key : ";" + item.Key;
|
a++;
|
}
|
}
|
|
private void cmdHProcID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsIF_Process_View oProc = new SCM.ClsIF_Process_View();
|
string sWhere = "";
|
if (oProc.RefreshView(sWhere))
|
{
|
this.txtHProcName.Text = oProc.oModel.HName;
|
this.txtHProcName.Tag = oProc.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHProcName.Text = "";
|
}
|
}
|
}
|
}
|