private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if ((sender as DataGridView).RowCount == 0) { return; } if (!string.IsNullOrEmpty((sender as DataGridView).Rows[e.RowIndex].Cells["clnMRPElement"].Value.ToString())) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "This Material Code already order !!"); return; } if ((sender as DataGridView).SelectedRows[0].Cells["clnMRPType"].Value.ToString() == "Prd Order") { if (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value) <= 0) { string strTmp = string.Empty; foreach (object item in this.hsTmp.Keys) { if ((sender as DataGridView).Name.Trim() == this.hsTmp[item].ToString()) { strTmp = item.ToString(); NP_Cls.MRPSO = (sender as DataGridView).SelectedRows[0].Cells["clnSO"].Value.ToString(); break; } } if (NP.MSGB("Do you want to open Prd Order : '" + strTmp.Split('_')[0].ToString() + "' ?") == DialogResult.Yes) { NP_Cls.FromMRP = 1; NP_Cls.MRPFGSort = strTmp.Split('_')[0].ToString(); NP_Cls.MRPQty = (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value) < 0 ? -Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value) : Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value)); SaleTranSac.frmPrdOrder frm = new WMS.SaleTranSac.frmPrdOrder(); frm.StartPosition = FormStartPosition.CenterParent; frm.Width = 950; frm.Height = 500; frm.FormBorderStyle = FormBorderStyle.SizableToolWindow; frm.ShowDialog(); NP_Cls.FromMRP = 0; this.btnMRP_Click(sender, e); return; } else { return; } } } if ((sender as DataGridView).SelectedRows[0].Cells["clnMRPType"].Value.ToString() == "Plan Order") { if (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value) <= 0) { string strTmp = string.Empty; foreach (object item in this.hsTmp.Keys) { if ((sender as DataGridView).Name.Trim() == this.hsTmp[item].ToString()) { strTmp = item.ToString(); NP_Cls.MRPSO = (sender as DataGridView).SelectedRows[0].Cells["clnSO"].Value.ToString(); break; } } if (NP.MSGB("Do you want to open Plan Pr : '" + strTmp.Split('_')[0].ToString() + "' ?") == DialogResult.Yes) { NP_Cls.FromMRP = 1; NP_Cls.MRPFGSort = strTmp.Split('_')[0].ToString(); NP_Cls.MRPQty = (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value) < 0 ? -Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value) : Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnRequireQty"].Value)); PR_PO.frmPR frm = new WMS.PR_PO.frmPR(); frm.StartPosition = FormStartPosition.CenterParent; frm.FormBorderStyle = FormBorderStyle.SizableToolWindow; frm.Width = 950; frm.Height = 500; frm.ShowDialog(); NP_Cls.FromMRP = 0; this.btnMRP_Click(sender, e); return; } else { return; } } } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if ((sender as DataGridView).RowCount == 0) { return; } if (!string.IsNullOrEmpty((sender as DataGridView).Rows[e.RowIndex].Cells["clnMRPElement"].Value.ToString())) { NP.MSGB(NP_Cls.NPMgsStyle.WarningType, "This Material Code already order !!"); return; } if ((sender as DataGridView).SelectedRows[0].Cells["clnMRPType"].Value.ToString() == "Prd Order") { //24julyFix //if (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnReqQty"].Value) == 0) if (string.IsNullOrEmpty((sender as DataGridView).SelectedRows[0].Cells["clnMRPElement"].Value.ToString())) { string strTmp = string.Empty; strTmp = this.lblCompCodeName.Text.Trim(); NP_Cls.MRPSO = (sender as DataGridView).SelectedRows[0].Cells["clnSO"].Value.ToString(); if (NP.MSGB("Do you want to open Prd Order : '" + strTmp + "' ?") == DialogResult.Yes) { NP_Cls.FromMRP = 1; NP_Cls.MRPFGSort = strTmp; NP_Cls.MRPQty = (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnAvaQty"].Value) < 0 ? -Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnAvaQty"].Value) : Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnAvaQty"].Value)); //(Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnAvaQty"].Value) < 0 ? -Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnReqQty"].Value) : Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnReqQty"].Value)); SaleTranSac.frmPrdOrder frm = new WMS.SaleTranSac.frmPrdOrder(); frm.StartPosition = FormStartPosition.CenterParent; frm.Width = 970; frm.Height = 500; frm.FormBorderStyle = FormBorderStyle.Sizable; frm.ControlBox = true; frm.ShowDialog(); NP_Cls.FromMRP = 0; this.frmComponentRunning_Load(sender, e); return; } else { return; } } } if ((sender as DataGridView).SelectedRows[0].Cells["clnMRPType"].Value.ToString() == "Plan Order") { //24julyFix //if (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnReqQty"].Value) == 0) if (string.IsNullOrEmpty((sender as DataGridView).SelectedRows[0].Cells["clnMRPElement"].Value.ToString())) { string strTmp = string.Empty; strTmp = this.lblCompCodeName.Text.Trim(); NP_Cls.MRPSO = (sender as DataGridView).SelectedRows[0].Cells["clnSO"].Value.ToString(); if (NP.MSGB("Do you want to open Plan Pr : '" + strTmp + "' ?") == DialogResult.Yes) { NP_Cls.FromMRP = 1; NP_Cls.MRPFGSort = strTmp; NP_Cls.nAutoID = (sender as DataGridView).SelectedRows[0].Cells["clnAutoID"].Value.ToString(); NP_Cls.MRPQty = (Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnAvaQty"].Value) < 0 ? -Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnAvaQty"].Value) : Convert.ToDouble((sender as DataGridView).SelectedRows[0].Cells["clnAvaQty"].Value)); PR_PO.frmPR frm = new WMS.PR_PO.frmPR(); frm.StartPosition = FormStartPosition.CenterParent; frm.FormBorderStyle = FormBorderStyle.Sizable; frm.Width = 970; frm.Height = 500; frm.ControlBox = true; frm.ShowDialog(); NP_Cls.FromMRP = 0; NP_Cls.nAutoID = string.Empty; this.frmComponentRunning_Load(sender, e); return; } else { return; } } } } catch { } }