Пример #1
0
 private ErrorReport fillErrorReport(ErrorReport errorReport, List<?> l) {
   for (Object o : l) {
     if (o instanceof PaymentData) {
       PaymentData pd = (PaymentData) o;
       errorReport = fillErrorReport(errorReport, pd.getPayment().getPayBeginClientResult());
       errorReport = fillErrorReport(errorReport, pd.getPayment().getPayBeginServerResult());
       errorReport = fillErrorReport(errorReport, pd.getPayment().getPayDoWorkClientResult());
       errorReport = fillErrorReport(errorReport, pd.getPayment().getPayDoWorkServerResult());
       errorReport = fillErrorReport(errorReport, pd.getPayment().getPayEndClientResult());
       errorReport = fillErrorReport(errorReport, pd.getPayment().getPayEndServerResult());
       //				fillErrorReport(errorReport, pd.getPayment().getFailurePaymentResult());
     }
     if (o instanceof DeliveryData) {
       DeliveryData dd = (DeliveryData) o;
       errorReport = fillErrorReport(errorReport, dd.getDelivery().getDeliverBeginClientResult());
       errorReport = fillErrorReport(errorReport, dd.getDelivery().getDeliverBeginServerResult());
       errorReport = fillErrorReport(errorReport, dd.getDelivery().getDeliverDoWorkClientResult());
       errorReport = fillErrorReport(errorReport, dd.getDelivery().getDeliverDoWorkServerResult());
       errorReport = fillErrorReport(errorReport, dd.getDelivery().getDeliverEndClientResult());
       errorReport = fillErrorReport(errorReport, dd.getDelivery().getDeliverEndServerResult());
       //				fillErrorReport(errorReport, dd.getDelivery().getFailureDeliveryResult());
     }
   }
   return errorReport;
 }
Пример #2
0
  protected void solveAutomaticPressed() {
    okPressed();
    Set<ArticleID> articleIDs = new HashSet<ArticleID>();

    if (getPaymentDatas() != null
        && (transferWizard.getTransferMode() & TransferWizard.TRANSFER_MODE_PAYMENT) > 0) {
      // add all ArticleIDs from all invoices of all payments
      Set<PayableObjectID> payableObjectIDs = new HashSet<PayableObjectID>();
      for (PaymentData pd : getPaymentDatas()) {
        payableObjectIDs.addAll(pd.getPayment().getPayableObjectIDs());
      }
      Set<InvoiceID> invoiceIDs = CollectionUtil.castSet(payableObjectIDs);
      List<Invoice> invoices =
          InvoiceDAO.sharedInstance()
              .getInvoices(
                  invoiceIDs,
                  new String[] {FetchPlan.DEFAULT, Invoice.FETCH_GROUP_ARTICLES},
                  NLJDOHelper.MAX_FETCH_DEPTH_NO_LIMIT,
                  new NullProgressMonitor());
      for (Invoice invoice : invoices) {
        Collection<? extends ArticleID> tmpArticleIDSet =
            NLJDOHelper.getObjectIDSet(invoice.getArticles());
        articleIDs.addAll(tmpArticleIDSet);
      }
    }
    if (getDeliveryDatas() != null
        && (transferWizard.getTransferMode() & TransferWizard.TRANSFER_MODE_DELIVERY) > 0) {
      // add all ArticleIDs from all deliveryNotes of all deliveries
      for (DeliveryData dd : getDeliveryDatas()) {
        articleIDs.addAll(dd.getDelivery().getArticleIDs());
      }
    }

    CombiTransferArticlesWizard wizard =
        new CombiTransferArticlesWizard(articleIDs, transferWizard.getTransferMode());
    wizard.setErrorHandler(new QuickSaleErrorHandler());
    DynamicPathWizardDialog dialog = new DynamicPathWizardDialog(wizard);
    dialog.open();
    this.transfersSuccessful = wizard.isTransfersSuccessful();
  }
Пример #3
0
  public ErrorDialog(
      Shell parentShell,
      List<PaymentData> paymentDatas,
      List<DeliveryData> deliveryDatas,
      TransferWizard transferWizard) {
    super(parentShell, null);
    setShellStyle(
        SWT.CLOSE
            | SWT.TITLE
            | SWT.BORDER
            | SWT.APPLICATION_MODAL
            | SWT.RESIZE
            | getDefaultOrientation());

    this.transferWizard = transferWizard;
    this.paymentDatas = paymentDatas;
    this.deliveryDatas = deliveryDatas;
    if (paymentDatas == null && deliveryDatas == null)
      throw new IllegalArgumentException(
          "paymentDatas == null && deliveryDatas == null"); //$NON-NLS-1$

    if (paymentDatas != null) {
      for (PaymentData paymentData : paymentDatas) {
        Payment payment = paymentData.getPayment();
        if (payment.isFailed()) failed = true;

        //				if (!payment.isRolledBack())
        //					completeRollback = false;
      }
    }

    if (deliveryDatas != null) {
      for (DeliveryData deliveryData : deliveryDatas) {
        Delivery delivery = deliveryData.getDelivery();
        if (delivery.isFailed()) failed = true;

        //				if (!delivery.isRolledBack())
        //					completeRollback = false;
      }
    }

    if (!failed) {
      if (paymentDatas != null) {
        for (PaymentData paymentData : paymentDatas) {
          Payment payment = paymentData.getPayment();
          if (payment.getPayBeginClientResult() == null
              || payment.getPayBeginServerResult() == null
              || payment.getPayDoWorkClientResult() == null
              || payment.getPayDoWorkServerResult() == null
              || payment.getPayEndClientResult() == null
              || payment.getPayEndServerResult() == null)
            throw new IllegalStateException(
                "At least one of the pay-results is missing!!!"); //$NON-NLS-1$
        }
      }

      if (deliveryDatas != null) {
        for (DeliveryData deliveryData : deliveryDatas) {
          Delivery delivery = deliveryData.getDelivery();
          if (delivery.getDeliverBeginClientResult() == null
              || delivery.getDeliverBeginServerResult() == null
              || delivery.getDeliverDoWorkClientResult() == null
              || delivery.getDeliverDoWorkServerResult() == null
              || delivery.getDeliverEndClientResult() == null
              || delivery.getDeliverEndServerResult() == null)
            throw new IllegalStateException(
                "At least one of the deliver-results is missing!!!"); //$NON-NLS-1$
        }
      }
    } // if (!failed) {
  }