/// <summary>
 ///     执行确定命令。
 /// </summary>
 /// <param name="sender"></param>
 public void OnCommitExecute(object sender)
 {
     if (SelectMaintainPaymentSchedule != null)
     {
         if (SelectPaymentScheduleLine == null)
         {
             MessageAlert("请选择一条付款计划行!");
         }
         else
         {
             if (_currentType == typeof (AirframeMaintainInvoiceDTO))
             {
                 var maintainInvoice = new AirframeMaintainInvoiceDTO
                 {
                     AirframeMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                     OperatorName = StatusData.curUser
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else if (_currentType == typeof (APUMaintainInvoiceDTO))
             {
                 var maintainInvoice = new APUMaintainInvoiceDTO
                 {
                     APUMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else if (_currentType == typeof (EngineMaintainInvoiceDTO))
             {
                 var maintainInvoice = new EngineMaintainInvoiceDTO
                 {
                     EngineMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else if (_currentType == typeof (UndercartMaintainInvoiceDTO))
             {
                 var maintainInvoice = new UndercartMaintainInvoiceDTO
                 {
                     UndercartMaintainInvoiceId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     InMaintainTime = DateTime.Now,
                     OutMaintainTime = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             else
             {
                 var maintainInvoice = new SpecialRefitInvoiceDTO
                 {
                     SpecialRefitId = RandomHelper.Next(),
                     CreateDate = DateTime.Now,
                     InvoiceDate = DateTime.Now,
                     SupplierId = SelectMaintainPaymentSchedule.SupplierId,
                     SupplierName = SelectMaintainPaymentSchedule.SupplierName,
                     CurrencyId = SelectMaintainPaymentSchedule.CurrencyId,
                     PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId,
                 };
                 prepayPayscheduleChildView.Tag = maintainInvoice;
             }
             prepayPayscheduleChildView.Close();
         }
     }
     else
     {
         MessageAlert("未选中维修付款计划!");
     }
 }
 private void OnNew(object obj)
 {
     MessageConfirm("是否根据付款计划创建?", (s, arg) =>
     {
         if (arg.DialogResult != true)
         {
             SelectRefitInvoice = new SpecialRefitInvoiceDTO
             {
                 SpecialRefitId =
                     RandomHelper.Next(),
                 CreateDate = DateTime.Now,
                 InvoiceDate = DateTime.Now,
                 InMaintainTime = DateTime.Now,
                 OutMaintainTime = DateTime.Now,
                 OperatorName = StatusData.curUser
             };
             var currency = Currencies.FirstOrDefault();
             if (currency != null)
                 SelectRefitInvoice.CurrencyId = currency.Id;
             var supplier = Suppliers.FirstOrDefault();
             if (supplier != null)
             {
                 SelectRefitInvoice.SupplierId = supplier.SupplierId;
                 SelectRefitInvoice.SupplierName = supplier.Name;
             }
             SpecialRefitInvoices.AddNew(SelectRefitInvoice);
             return;
         }
         prepayPayscheduleChildView.ViewModel.InitData(
             typeof (SpecialRefitInvoiceDTO), PrepayPayscheduleChildViewClosed);
         prepayPayscheduleChildView.ShowDialog();
     });
 }