private void BtnAddDetail_Click(object sender, RoutedEventArgs e)
 {
     if (CurrentPipeOrder.Id == null)
     {
         MessageBox.Show("请先选择主数据");
     }
     else
     {
         WinCutPlanAddOrEdit win = new WinCutPlanAddOrEdit(null, CurrentPipeOrder);
         win.ShowDialog();
         QueryDetail(CurrentPipeOrder);
     }
 }
 private void BtnEditDetial_Click(object sender, RoutedEventArgs e)
 {
     if (CurrentPipeOrder.Id == null)
     {
         MessageBox.Show("请先选择主数据");
     }
     if (DGDetail.SelectedItems.Count > 1)
     {
         MessageBox.Show("每次只能选择一条");
         return;
     }
     else if (DGDetail.SelectedItem == null)
     {
         MessageBox.Show("请选择一行明细数据");
     }
     else
     {
         var a = (CutPlan)DGDetail.SelectedItem;
         WinCutPlanAddOrEdit win = new WinCutPlanAddOrEdit(a.Id, CurrentPipeOrder);
         win.ShowDialog();
         QueryDetail(CurrentPipeOrder);
     }
 }