Beispiel #1
0
        //选择材料
        private void selectMaterail()
        {
            string t_materailId = null;

            for (int i = 0; i < dgv_MaterialList.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell checkcell = (DataGridViewCheckBoxCell)dgv_MaterialList.Rows[i].Cells[0];
                Boolean flag = Convert.ToBoolean(checkcell.Value);
                if (flag)
                {
                    t_materailId = dgv_MaterialList.Rows[i].Cells["MATERIALID"].Value.ToString().Trim();
                }
            }
            if (t_materailId == null)
            {
                MessageBox.Show("请选择一个材料"); return;
            }

            if (filterSelect(t_materailId) == -1)
            {
                MessageBox.Show("已经在产品结构中"); return;
            }


            HYPDM.Entities.PDM_STRUCT temp_struct = new HYPDM.Entities.PDM_STRUCT();
            temp_struct.OBJECTID    = this.copy_Product.PRODUCTID;
            temp_struct.ASSOBJECTID = t_materailId;

            StructAddForm o = new StructAddForm(temp_struct, m_assoID, this.m_assoType);

            o.StartPosition = FormStartPosition.CenterParent;
            o.ShowDialog();
        }
Beispiel #2
0
        //选择产品
        private void selectProduct()
        {
            string t_productId = null;
            string t_productNo = "";//产品编号

            for (int i = 0; i < this.dgv_productList.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell checkcell = (DataGridViewCheckBoxCell)dgv_productList.Rows[i].Cells[0];
                Boolean flag = Convert.ToBoolean(checkcell.Value);
                if (flag)
                {
                    t_productId = dgv_productList.Rows[i].Cells["PRODUCTID"].Value.ToString().Trim();
                    t_productNo = dgv_productList.Rows[i].Cells["PRODUCTNO"].Value.ToString().Trim();
                }
            }
            if (t_productId == null)
            {
                MessageBox.Show("请选择一个产品"); return;
            }

            if (this.copy_Product.PRODUCTID == t_productId)
            {
                MessageBox.Show("产品不能与自己关联"); return;
            }

            if (filterSelect(t_productId) == -1)
            {
                MessageBox.Show("该产品已经在产品结构中"); return;
            }

            if (filterCycle(t_productId))
            {
                MessageBox.Show(t_productNo + "结构中包含:" + this.copy_Product.PRODUCTNO + ",不能添加。\n否则产品结构形成循环!"); return;
            }

            HYPDM.Entities.PDM_STRUCT temp_struct = new HYPDM.Entities.PDM_STRUCT();
            temp_struct.OBJECTID    = this.copy_Product.PRODUCTID;
            temp_struct.ASSOBJECTID = t_productId;

            StructAddForm o = new StructAddForm(temp_struct, m_assoID, this.m_assoType);

            o.StartPosition = FormStartPosition.CenterParent;
            o.ShowDialog();
        }
Beispiel #3
0
        /// <summary>
        ///  修改产品结构
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStructEdit_Click(object sender, EventArgs e)
        {
            //1.找出需要修改的产品结构
            PDM_STRUCT       t_struct = new PDM_STRUCT();
            TreeListViewItem item = this.list_productTreeStruct.Items[0];
            int count = 0; int index = 0;

            for (int i = 0; i < item.Items.Count; i++)
            {
                if (item.Items[i].CheckStatus == CheckState.Checked)
                {
                    count++;
                    index = i;
                }
            }
            if (count != 1)
            {
                MessageBox.Show("只能选择一条记录且子结构无法更改!");
                return;
            }

            t_struct.OBJECTID    = this.m_product.PRODUCTID;
            t_struct.ASSOBJECTID = item.Items[index].Tag.ToString();

            //2.记录修改界面传递(关联对象,关联对象ID,操作类型--修改)参数
            StructAddForm o = new StructAddForm(t_struct, "", Enum_AssOpType.EDIT);

            o.StartPosition = FormStartPosition.CenterParent;

            //3.判断是否修改如果修改(清空产品结构树,并重新构造树)
            if (o.ShowDialog() == DialogResult.OK)
            {
                this.list_productTreeStruct.Items.Clear();
                list_productTreeStruct_init();
            }
        }
        //选择产品
        private void selectProduct()
        {
            string t_productId = null;
            string t_productNo = "";//产品编号
            for (int i = 0; i < this.dgv_productList.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell checkcell = (DataGridViewCheckBoxCell)dgv_productList.Rows[i].Cells[0];
                Boolean flag = Convert.ToBoolean(checkcell.Value);
                if (flag)
                {
                    t_productId = dgv_productList.Rows[i].Cells["PRODUCTID"].Value.ToString().Trim();
                    t_productNo = dgv_productList.Rows[i].Cells["PRODUCTNO"].Value.ToString().Trim();
                }
            }
            if (t_productId == null) { MessageBox.Show("请选择一个产品"); return; }

            if (this.copy_Product.PRODUCTID == t_productId)
            {
                MessageBox.Show("产品不能与自己关联"); return;
            }

            if (filterSelect(t_productId)==-1)
            {
                MessageBox.Show("该产品已经在产品结构中"); return;
            }

            if (filterCycle(t_productId))
            {
                MessageBox.Show(t_productNo+"结构中包含:"+this.copy_Product.PRODUCTNO+",不能添加。\n否则产品结构形成循环!"); return;
            }

            HYPDM.Entities.PDM_STRUCT temp_struct = new HYPDM.Entities.PDM_STRUCT();
            temp_struct.OBJECTID = this.copy_Product.PRODUCTID;
            temp_struct.ASSOBJECTID = t_productId;

            StructAddForm o = new StructAddForm(temp_struct, m_assoID, this.m_assoType);
            o.StartPosition = FormStartPosition.CenterParent;
            o.ShowDialog();
        }
        //选择材料
        private void selectMaterail()
        {
            string t_materailId=null;
            for (int i = 0; i < dgv_MaterialList.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell checkcell = (DataGridViewCheckBoxCell)dgv_MaterialList.Rows[i].Cells[0];
                Boolean flag = Convert.ToBoolean(checkcell.Value);
                if (flag)
                {
                    t_materailId = dgv_MaterialList.Rows[i].Cells["MATERIALID"].Value.ToString().Trim();
                }
            }
            if (t_materailId == null) { MessageBox.Show("请选择一个材料"); return; }

            if (filterSelect(t_materailId) == -1)
            {
                MessageBox.Show("已经在产品结构中"); return;
            }

            HYPDM.Entities.PDM_STRUCT temp_struct = new HYPDM.Entities.PDM_STRUCT();
            temp_struct.OBJECTID = this.copy_Product.PRODUCTID;
            temp_struct.ASSOBJECTID = t_materailId;

            StructAddForm o = new StructAddForm(temp_struct, m_assoID, this.m_assoType);
            o.StartPosition = FormStartPosition.CenterParent;
            o.ShowDialog();
        }
Beispiel #6
0
        /// <summary>
        ///  修改产品结构
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStructEdit_Click(object sender, EventArgs e)
        {
            //1.找出需要修改的产品结构
            PDM_STRUCT t_struct = new PDM_STRUCT();
            TreeListViewItem item = this.list_productTreeStruct.Items[0];
            int count = 0; int index=0;
            for (int i = 0; i < item.Items.Count; i++)
            {
                if (item.Items[i].CheckStatus == CheckState.Checked)
                {
                    count ++;
                    index = i;
                }
            }
            if (count != 1) {
                MessageBox.Show("只能选择一条记录且子结构无法更改!");
                return;
            }

            t_struct.OBJECTID = this.m_product.PRODUCTID;
            t_struct.ASSOBJECTID = item.Items[index].Tag.ToString();

            //2.记录修改界面传递(关联对象,关联对象ID,操作类型--修改)参数
            StructAddForm o = new StructAddForm(t_struct, "", Enum_AssOpType.EDIT);
            o.StartPosition = FormStartPosition.CenterParent;

            //3.判断是否修改如果修改(清空产品结构树,并重新构造树)
            if (o.ShowDialog() == DialogResult.OK)
            {
                this.list_productTreeStruct.Items.Clear();
                list_productTreeStruct_init();
            }
        }