Beispiel #1
0
        public override void tool1_BOM_Click(object sender, EventArgs e)
        {
            base.tool1_BOM_Click(sender, e);
            if (this.myDataGridViewHead.RowCount == 0)
            {
                return;
            }
            if (this.myDataGridViewHead.CurrentRow.Cells["产品id"].Value == DBNull.Value)
            {
                return;
            }
            #region 判断是否已经有打开的BOM窗体
            foreach (Form childFrm in this.MdiParent.MdiChildren)
            {
                if (childFrm.Name == "FormProductBOM")
                {
                    FormProductBOM orderBomForm = (FormProductBOM)childFrm;
                    if (orderBomForm.mnPId == Convert.ToInt32(this.myDataGridViewHead.CurrentRow.Cells["产品id"].Value))
                    {
                        childFrm.Activate();
                        return;
                    }
                }
            }
            #endregion

            FormProductBOM formBOM = new FormProductBOM();
            formBOM.mbShow    = false;
            formBOM.mnPId     = Convert.ToInt32(this.myDataGridViewHead.CurrentRow.Cells["产品id"].Value);
            formBOM.mstrName  = this.myDataGridViewHead.CurrentRow.Cells["产品型号"].Value.ToString();
            formBOM.mstrColor = this.myDataGridViewHead.CurrentRow.Cells["产品颜色"].Value.ToString();
            formBOM.MdiParent = this.MdiParent;
            formBOM.Show();
        }
        //BOM结构
        private void tool1_BOM_Click(object sender, EventArgs e)
        {
            if (rowHead.RowState == DataRowState.Added)
            {
                SysMessage.InformationMsg("新增产品资料未保存,不允许执行该操作!");
                return;
            }
            #region 判断是否已经有打开的BOM窗体
            foreach (Form childFrm in this.MdiParent.MdiChildren)
            {
                if (childFrm.Name == "FormFitBOM")
                {
                    FormProductBOM orderBomForm = (FormProductBOM)childFrm;
                    if (orderBomForm.mnPId == Convert.ToInt32(rowHead["产品id"]))
                    {
                        childFrm.Activate();
                        return;
                    }
                }
            }
            #endregion

            FormProductBOM formBOM = new FormProductBOM();
            formBOM.mbShow    = false;
            formBOM.mnPId     = Convert.ToInt32(rowHead["产品id"]);
            formBOM.mstrName  = rowHead["产品型号"].ToString();
            formBOM.mstrColor = rowHead["产品颜色"].ToString();
            formBOM.MdiParent = this.MdiParent;
            formBOM.Show();
        }