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
        //保存按钮操作
        private void btn_save_Click(object sender, EventArgs e)
        {
            HYPDM.Entities.PDM_STRUCT temp_struct = new HYPDM.Entities.PDM_STRUCT();

            temp_struct.OBJECTID    = this.m_struct.OBJECTID;
            temp_struct.ASSOBJECTID = this.m_struct.ASSOBJECTID;
            if (string.IsNullOrEmpty(this.tb_assoNum.Text.Trim()))
            {
                MessageBox.Show("数量必须填写"); return;
            }
            temp_struct.ASSONUM    = this.tb_assoNum.Text;
            temp_struct.ASSOWEIGHT = this.tb_assoWeight.Text;
            temp_struct.SORTNUM    = this.tb_sortNum.Text;
            temp_struct.MEMO       = this.rtb_memo.Text;
            //temp_struct.Save();//需要表有主键
            if (this.m_assoPType == Enum_AssOpType.SAVE)
            {
                m_structService.saveStruct(temp_struct);
                MessageBox.Show("添加成功");
            }
            else if (this.m_assoPType == Enum_AssOpType.EDIT)
            {
                m_structService.editStruct(temp_struct, this.m_assojectId);
                MessageBox.Show("修改成功");
            }
            else if (this.m_assoPType == Enum_AssOpType.INSERT)
            {
                m_structService.transactionExc(temp_struct.OBJECTID, (Convert.ToInt16(temp_struct.SORTNUM) - 1).ToString());
                m_structService.saveStruct(temp_struct);
                MessageBox.Show("插入成功");
            }
            else if (this.m_assoPType == Enum_AssOpType.REPLACE)
            {
                m_structService.editStruct(temp_struct, this.m_assojectId);
                MessageBox.Show("替换成功");
            }
            this.DialogResult = DialogResult.OK;
        }
Beispiel #4
0
        //保存按钮操作
        private void btn_save_Click(object sender, EventArgs e)
        {
            HYPDM.Entities.PDM_STRUCT temp_struct = new HYPDM.Entities.PDM_STRUCT();

            temp_struct.OBJECTID = this.m_struct.OBJECTID;
            temp_struct.ASSOBJECTID = this.m_struct.ASSOBJECTID;
            if (string.IsNullOrEmpty(this.tb_assoNum.Text.Trim()))
            {
                MessageBox.Show("数量必须填写"); return;
            }
            temp_struct.ASSONUM = this.tb_assoNum.Text;
            temp_struct.ASSOWEIGHT = this.tb_assoWeight.Text;
            temp_struct.SORTNUM = this.tb_sortNum.Text;
            temp_struct.MEMO=this.rtb_memo.Text;
            //temp_struct.Save();//需要表有主键
            if (this.m_assoPType == Enum_AssOpType.SAVE)
            {
                m_structService.saveStruct(temp_struct);
                MessageBox.Show("添加成功");
            }
            else if (this.m_assoPType == Enum_AssOpType.EDIT)
            {
                m_structService.editStruct(temp_struct, this.m_assojectId);
                MessageBox.Show("修改成功");
            }
            else if (this.m_assoPType == Enum_AssOpType.INSERT)
            {
                m_structService.transactionExc(temp_struct.OBJECTID,(Convert.ToInt16(temp_struct.SORTNUM) - 1).ToString());
                m_structService.saveStruct(temp_struct);
                MessageBox.Show("插入成功");
            }
            else if (this.m_assoPType == Enum_AssOpType.REPLACE) {
                m_structService.editStruct(temp_struct,this.m_assojectId);
                MessageBox.Show("替换成功");
            }
            this.DialogResult = DialogResult.OK;
        }
        //选择产品
        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();
        }