Esempio n. 1
0
        /// <summary>
        /// 工料机编号替换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            this.GetCurrent();
            this.GetPartQuantityUnit();
            InsertQuantityUnit form = new InsertQuantityUnit();

            form.Activitie = this.Activitie;
            if (this.m_Methods_Quantity.Current != null)
            {
                form.BH = this.m_Methods_Quantity.Current["YSBH"].ToString();
            }
            form.simpleButton3.Visible = false;
            DialogResult r = form.ShowDialog();

            if (r == DialogResult.Yes)
            {
                DataRow new_info = form.GetNewInfo();
                if (new_info == null)
                {
                    return;
                }
                if (this.m_Methods_Subheadings.ReplaceGLJ(this.m_Methods_Quantity.Current, new_info))
                {
                    this.m_Methods_Subheadings.Begin(null);
                }
                else
                {
                    MsgBox.Alert(new_info["BH"].ToString() + "已经存在");
                }
                this.RefreshDataSource();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 组成工料机编号替换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            this.GetCurrent();
            this.GetPartQuantityUnit();
            InsertQuantityUnit form = new InsertQuantityUnit();

            form.Activitie = this.Activitie;
            if (this.m_Methods_Quantity.Current != null)
            {
                form.BH = this.m_Methods_Quantity.Current["YSBH"].ToString();
            }
            form.simpleButton3.Visible = false;
            DialogResult r = form.ShowDialog();

            if (r == DialogResult.Yes)
            {
                DataRow new_info = form.GetNewInfo();
                if (new_info == null)
                {
                    return;
                }
                APP.UserPriceLibrary.Range = 1;
                if (new_info["LB"].Equals("配合比") || new_info["LB"].ToString().Contains("台班"))
                {
                    MsgBox.Alert("您不能将该材料添加到组成里! 请重新选择!");
                }
                else
                {
                    if (this.m_Methods_Quantity.ReplaceGLJ(new_info))
                    {
                        this.m_Methods_Subheadings.Begin(null);
                    }
                    else
                    {
                        MsgBox.Alert(new_info["BH"].ToString() + "已经存在");
                    }
                }
                this.RefreshDataSource();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 增加组成工料机
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.GetCurrent();
            this.GetPartQuantityUnit();
            InsertQuantityUnit form = new InsertQuantityUnit();

            form.Activitie = this.Activitie;
            if (this.m_Methods_Quantity.Current != null)
            {
                form.BH = this.m_Methods_Quantity.Current["YSBH"].ToString();
            }
            DialogResult r = form.ShowDialog();

            if (r == DialogResult.OK || r == DialogResult.Yes)
            {
                DataRow new_info = form.GetNewInfo();
                if (new_info == null)
                {
                    return;
                }
                if (new_info["LB"].Equals("配合比") || new_info["LB"].ToString().Contains("台班"))
                {
                    MsgBox.Alert("您不能将该材料添加到组成里! 请重新选择!");
                    return;
                }
                APP.UserPriceLibrary.Range = 1;
                switch (r)
                {
                //插入
                case DialogResult.OK:
                    if (this.m_Methods_Quantity.Create(new_info))
                    {
                        Calculator.Calculate(CurrentBusiness, Activitie, m_Methods_Subheadings.Current);
                        Activitie.NeedCalculate = true;
                    }
                    else
                    {
                        MsgBox.Alert(new_info["BH"].ToString() + "已经存在");
                    }
                    break;

                //替换
                case DialogResult.Yes:
                    if (this.m_Methods_Quantity.Current == null)
                    {
                        MsgBox.Alert("请选择一条工料机后替换");
                    }
                    else
                    {
                        if (this.m_Methods_Quantity.ReplaceGLJ(new_info))
                        {
                            Calculator.Calculate(CurrentBusiness, Activitie, m_Methods_Subheadings.Current);
                            this.Activitie.NeedCalculate = true;
                        }
                        else
                        {
                            MsgBox.Alert(new_info["BH"].ToString() + "已经存在");
                        }
                    }
                    break;

                default:
                    break;
                }
                this.RefreshDataSource();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 添加工料机按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.GetCurrent();
            InsertQuantityUnit form = new InsertQuantityUnit();

            form.Activitie = this.Activitie;
            if (this.m_Methods_Quantity.Current != null)
            {
                form.BH = this.m_Methods_Quantity.Current["YSBH"].ToString();
            }
            DialogResult r = form.ShowDialog();

            if (r == DialogResult.OK || r == DialogResult.Yes)
            {
                using (var calculator = new Calculator(CurrentBusiness, Activitie))
                {
                    DataRow new_info = form.GetNewInfo();
                    if (new_info == null)
                    {
                        return;
                    }
                    switch (r)
                    {
                    //插入
                    case DialogResult.OK:
                        if (m_Methods_Subheadings.CreateGLJ(this.m_Methods_Quantity.Current, new_info))
                        {
                            this.m_Methods_Subheadings.BeginCurrent();

                            calculator.Entities.Add(m_Methods_Subheadings.Current);
                        }
                        else
                        {
                            MsgBox.Alert(new_info["BH"].ToString() + "已经存在");
                        }
                        break;

                    //替换
                    case DialogResult.Yes:
                        if (this.m_Methods_Quantity.Current == null)
                        {
                            MsgBox.Alert("请选择一条工料机后替换");
                        }
                        else
                        {
                            if (this.m_Methods_Subheadings.ReplaceGLJ(this.m_Methods_Quantity.Current, new_info))
                            {
                                this.m_Methods_Subheadings.BeginCurrent();

                                calculator.Entities.Add(m_Methods_Subheadings.Current);
                            }
                            else
                            {
                                MsgBox.Alert(new_info["BH"].ToString() + "已经存在");
                            }
                        }
                        break;

                    default:
                        break;
                    }

                    this.RefreshDataSource();
                }
            }
        }