using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; namespace SSLMS.MobileUI.uc { public partial class ucPLAN_QUERY : UserControl { private string _PLAN_STATUS = string.Empty; private ucGrid ugPLAN = new ucGrid(); private DataRow _drPLAN { get { DataRow dr = null; MyDataGrid mdgv = ugPLAN.dgv; if (null == mdgv) { return dr; } dr = mdgv.GetCurDataRow(); return dr; } } public ucPLAN_QUERY() { this.InitializeComponent(); } public ucPLAN_QUERY(string PLAN_STATUS) { this.InitializeComponent(); ugPLAN.Dock = DockStyle.Fill; ugPLAN.dgv.Click += new EventHandler(dgv_Click); this.Controls.Add(ugPLAN); if (!string.IsNullOrEmpty(PLAN_STATUS)) { this._PLAN_STATUS = string.Format(" and PLAN_STATUS in ({0})", PLAN_STATUS.Replace('|', ',')); } this.IO_PLAN_Bind(); } private void IO_PLAN_Bind() { try { ugPLAN.sTable = "V_PLAN"; ugPLAN.sXml = "PLAN_MAIN"; ugPLAN.sWhere = string.Format(" {0} ", this._PLAN_STATUS); ugPLAN.Init(); this.PLAN_Change(); } catch (Exception ex) { MessageBox.Show("系统异常" + ex.Message); } } private void PLAN_Change() { try { if (null == this._drPLAN) { return; } this.PLAN_ACTION_Bind(); } catch (Exception ex) { MessageBox.Show("系统异常" + ex.Message); } } private void PLAN_ACTION_Bind() { try { this.plPlan.Controls.Clear(); Button btnRefresh = new Button(); btnRefresh.Name = "btnRefresh"; btnRefresh.Text = "刷新"; btnRefresh.Location = new Point(0, 0); plPlan.Controls.Add(btnRefresh); btnRefresh.Click += new EventHandler(btn_Click); switch (this._drPLAN["PLAN_TYPE_GROUP"].ToString()) { case "1": Button btnIn = new Button(); btnIn.Name = "btnIn"; btnIn.Text = "入库"; btnIn.Location = new Point(btnRefresh.Right, 0); plPlan.Controls.Add(btnIn); btnIn.Click += new EventHandler(btn_Click); break; case "2": Button btnOut = new Button(); btnOut.Name = "btnOut"; btnOut.Text = "出库"; btnOut.Location = new Point(btnRefresh.Right, 0); plPlan.Controls.Add(btnOut); btnOut.Click += new EventHandler(btn_Click); break; } } catch (Exception ex) { MessageBox.Show("系统异常" + ex.Message); } } private void dgv_Click(object sender, EventArgs e) { this.PLAN_Change(); } private void tcIO_PLAN_SelectedIndexChanged(object sender, EventArgs e) { this.PLAN_Change(); } private void btn_Click(object sender, EventArgs e) { if (null == this._drPLAN) { MessageBox.Show("Please Select Invoice"); return; } try { string PLAN_ID = this._drPLAN["PLAN_ID"].ToString(); Button btn = sender as Button; switch (btn.Name) { case "btnIn": ucMANAGE_PLAN_IN MANAGE_PLAN_IN = new ucMANAGE_PLAN_IN(Convert.ToInt32(PLAN_ID), "ManageIn"); SSLMS.MobileUI.MAIN.frmMain.MAIN_AddControl(MANAGE_PLAN_IN, "入库"); break; case "btnOut": //ucMANAGE_INOUT MANAGE_OUT = new ucMANAGE_INOUT(PLAN_ID); //SSLMS.MobileUI.MAIN.frmMain.MAIN_AddControl(MANAGE_OUT, "出库"); break; //case "btnPeiPan": // ucMANAGE_CHANGE MANAGE_CHANGE = new ucMANAGE_CHANGE(PLAN_ID); // SSLMS.MobileUI.MAIN.frm.MAIN_AddControl(MANAGE_CHANGE, "配盘"); // break; case "btnRefresh": this.IO_PLAN_Bind(); break; } } catch (Exception ex) { MessageBox.Show("系统异常" + ex.Message); } } } }