/// <summary> /// 补充组成工料机 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem8_ItemClick(object sender, ItemClickEventArgs e) { this.GetCurrent(); this.GetPartQuantityUnit(); var form = new InsertRepairQuantityUnit() { Activitie = this.Activitie, LB = e.Item.Caption }; if (this.m_Methods_Quantity.Current != null) { form.MC = this.m_Methods_Quantity.Current["MC"].ToString(); } if (form.ShowDialog() == DialogResult.OK) { APP.UserPriceLibrary.Range = 1; var focusedRow = this.gridView1.GetFocusedDataRow() as DataRow; if (focusedRow != null) { using (var calculator = new Calculator(CurrentBusiness, Activitie)) { DataRow newRow = form.GetNewInfo(); if (newRow == null) { return; } if (this.m_Methods_Quantity.Create(newRow)) { if (form.radioGroup1.SelectedIndex == 1) { APP.RepairQuantityUnit.CreateZMGLJ(newRow); } calculator.Entities.Add(m_Methods_Subheadings.Current); } else { MsgBox.Alert(newRow["BH"].ToString() + "已经存在"); } } this.RefreshDataSource(); } else { MsgBox.Alert("请选择一条工料机!"); } } }
/// <summary> /// 补充工料机按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e) { this.GetCurrent(); this.GetPartQuantityUnit(); var form = new InsertRepairQuantityUnit() { Activitie = this.Activitie, LB = e.Item.Caption }; if (this.m_Methods_Quantity.Current != null) { form.MC = this.m_Methods_Quantity.Current["MC"].ToString(); } if (form.ShowDialog() == DialogResult.OK) { DataRow newRow = form.New_Row; if (newRow == null) { return; } if (m_Methods_Subheadings.CreateGLJ(this.m_Methods_Quantity.Current, newRow)) { if (form.radioGroup1.SelectedIndex == 0) { APP.RepairQuantityUnit.CreateZMGLJ(newRow); } Calculator.Calculate(CurrentBusiness, Activitie, m_Methods_Subheadings.Current); Activitie.NeedCalculate = true; RefreshDataSource(); if (form.IS_SAVE) { //保存补充才机库 APP.UserPriceLibrary.Save(); APP.RepairQuantityUnit.Save(); } } else { MsgBox.Alert(newRow["BH"].ToString() + "已经存在"); } } }