Package no.ugland.utransprod.service

Examples of no.ugland.utransprod.service.PostShipmentManager


   * @param window
   */
  private void initOrders(List<Transportable> transportables,
      WindowInterface window) {
    if (transportables != null) {
      PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
          .getBean("postShipmentManager");
      CustTrManager custTrManager = (CustTrManager) ModelUtil
          .getBean("custTrManager");
      Set<String> checkers = statusCheckers.keySet();
      Map<String, String> statusMap;

      String status;
      StatusCheckerInterface<Transportable> checker;
      boolean orderLoaded = false;
      boolean needToSave = false;

      for (Transportable transportable : transportables) {
        List<CustTr> custTrs = custTrManager
            .findByOrderNr(transportable.getOrder().getOrderNr());

        transportable.setCustTrs(custTrs);
        orderLoaded = false;
        needToSave = false;
        statusMap = Util.createStatusMap(transportable.getStatus());
        for (String checkerName : checkers) {
          checker = statusCheckers.get(checkerName);
          status = statusMap.get(checker.getArticleName());

          if (status == null) {
            needToSave = true;
            if (!orderLoaded && transportable instanceof Order) {
              orderViewHandler
                  .lazyLoadOrder(
                      (Order) transportable,
                      new LazyLoadOrderEnum[] {
                          LazyLoadOrderEnum.COLLIES,
                          LazyLoadOrderEnum.ORDER_LINES,
                          LazyLoadOrderEnum.ORDER_LINE_ORDER_LINES,
                          LazyLoadOrderEnum.COMMENTS });
              orderLoaded = true;
            } else if (!orderLoaded
                && transportable instanceof PostShipment) {
              postShipmentManager
                  .lazyLoad(
                      (PostShipment) transportable,
                      new LazyLoadPostShipmentEnum[] {
                          LazyLoadPostShipmentEnum.COLLIES,
                          LazyLoadPostShipmentEnum.ORDER_LINES,
                          LazyLoadPostShipmentEnum.ORDER_LINE_ORDER_LINES,
                          LazyLoadPostShipmentEnum.ORDER_COMMENTS });
              orderLoaded = true;
            }
            status = checker.getArticleStatus(transportable);

          }
          statusMap.put(checker.getArticleName(), status);

        }
        transportable.setStatus(Util.statusMapToString(statusMap));

        if (transportable.getComment() == null) {
          needToSave = true;
          cacheComment(transportable, window, !orderLoaded);
          orderLoaded = true;
        }
        if (transportable.getGarageColliHeight() == null) {
          needToSave = true;
          cacheGarageColliHeight(transportable, window, !orderLoaded);
          orderLoaded = true;
        }
        if (transportable.getTakstolHeight() == null) {
          needToSave = true;
          cacheTakstolHeight(transportable, window, !orderLoaded);
          orderLoaded = true;
        }

        if (needToSave) {
          if (transportable instanceof Order) {
            try {
              orderViewHandler.getOrderManager().saveOrder(
                  (Order) transportable);
            } catch (ProTransException e) {
              Util
                  .showErrorDialog(window, "Feil", e
                      .getMessage());
              e.printStackTrace();
            }
          } else {
            postShipmentManager
                .savePostShipment((PostShipment) transportable);
          }
        }
      }
    }
View Full Code Here


    when(managerRepository.getSumOrderReadyVManager()).thenReturn(
        sumOrderReadyVManager);
    BudgetManager budgetManager = (BudgetManager) ModelUtil
        .getBean(BudgetManager.MANAGER_NAME);
    when(managerRepository.getBudgetManager()).thenReturn(budgetManager);
    PostShipmentManager postShipmentManager=(PostShipmentManager)ModelUtil.getBean(PostShipmentManager.MANAGER_NAME);
    when(managerRepository.getPostShipmentManager()).thenReturn(postShipmentManager);

    final OrderManager orderManager = (OrderManager) ModelUtil
        .getBean(OrderManager.MANAGER_NAME);
   
View Full Code Here

      } catch (ProTransException e) {
        Util.showErrorDialog(window, "Feil", e.getMessage());
        e.printStackTrace();
      }
    } else {
      PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
          .getBean("postShipmentManager");
      postShipmentManager.savePostShipment((PostShipment) transportable);
    }
    return status;
  }
View Full Code Here

          new LazyLoadOrderEnum[] { LazyLoadOrderEnum.COLLIES,
              LazyLoadOrderEnum.ORDER_COSTS,
              LazyLoadOrderEnum.ORDER_LINES,
              LazyLoadOrderEnum.ORDER_LINE_ORDER_LINES });
    } else {
      PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
          .getBean("postShipmentManager");
      postShipmentManager.lazyLoad((PostShipment) transportable,
          new LazyLoadPostShipmentEnum[] {
              LazyLoadPostShipmentEnum.COLLIES,
              LazyLoadPostShipmentEnum.ORDER_LINES,
              LazyLoadPostShipmentEnum.ORDER_LINE_ORDER_LINES });
    }
View Full Code Here

  private Date handleTransportNotSent(
      final List<TransportListable> listTransportListable,
      final boolean saveTransport) throws ProTransException {
    Date sentDate;
    PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
        .getBean("postShipmentManager");
    sentDate = Util.getCurrentDate();

    Set<Colli> collies;
View Full Code Here

   * Fjerner transport fra ordre eller ettersending.
   *
   * @param window1
   */
  final void removeTransport(final WindowInterface window1) {
    PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
        .getBean("postShipmentManager");
    int index = tableOrders
        .convertRowIndexToModel(transportableSelectionList
            .getSelectionIndex());
    if (index != -1) {
      Transportable transportable = (Transportable) transportableSelectionList
          .getElementAt(index);
      if (transportable instanceof Order) {
        Order order = (Order) transportable;

        orderViewHandler
            .lazyLoadOrder(order, new LazyLoadOrderEnum[] {
                LazyLoadOrderEnum.POST_SHIPMENTS,
                LazyLoadOrderEnum.COMMENTS,
                LazyLoadOrderEnum.COLLIES });
      } else {
        PostShipment postShipment = (PostShipment) transportable;

        postShipmentManager.lazyLoad(postShipment,
            new LazyLoadPostShipmentEnum[] {
                LazyLoadPostShipmentEnum.POST_SHIPMENT_REFS,
                LazyLoadPostShipmentEnum.ORDER_COMMENTS,
                LazyLoadPostShipmentEnum.COLLIES });
      }
      if (transportable.getPostShipments() != null
          && transportable.getPostShipments().size() != 0) {
        Util.showErrorDialog(window1, "Ordre har etterleveringer",
            "Kan ikke fjerne ordre som har etterleveringer.");
        return;
      }
      transportable.setSentBool(false);
      transportable.setTransport(null);

      if (transportable instanceof Order) {
        Order order = (Order) transportable;

        orderViewHandler.lazyLoadOrder(order, new LazyLoadOrderEnum[] {
            LazyLoadOrderEnum.COLLIES,
            LazyLoadOrderEnum.ORDER_LINES,
            LazyLoadOrderEnum.ORDER_COSTS });
        Set<Colli> collies = order.getCollies();
        removeSentFromCollies(collies);

        Set<OrderLine> orderLines = order.getOrderLines();
        if (orderLines != null) {
          PostShipment postShipment;
          for (OrderLine orderLine : orderLines) {
            postShipment = orderLine.getPostShipment();
            Deviation deviation;
            if (postShipment != null) {
              orderLine.setPostShipment(null);
              deviation = postShipment.getDeviation();
              postShipment.setOrder(null);

              postShipmentManager
                  .removePostShipment(postShipment);

              if (deviation != null) {
                managerRepository.getDeviationManager()
                    .removeObject(deviation);
              }
            }
          }
        }

        orderViewHandler.refreshOrder(order);
        order.setSentBool(false);
        order.setTransport(null);
        try {
          vismaFileCreator.createVismaFileForTransport(order);

          orderViewHandler.getOrderManager().saveOrder(order);
        } catch (ProTransException e) {
          Util.showErrorDialog(window1, "Feil", e.getMessage());
          e.printStackTrace();
          return;
        }

        overviewManager
            .refreshObject(((TransportModel) transportPresentationModel
                .getBean()).getObject());
      } else {
        postShipmentManager
            .savePostShipment((PostShipment) transportable);
      }
      transportableList.remove(index);
      fireSentChange();
      transportPresentationModel.triggerCommit();
View Full Code Here

      SplitOrderViewHandler splitOrderViewHandler,
      Transportable transportable) {
    List<Object> splitted = splitOrderViewHandler.getSplitted();

    if (splitted != null && splitted.size() != 0) {
      PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
          .getBean("postShipmentManager");
      PostShipment postShipment = new PostShipment();
      postShipment.setOrder(transportable.getOrder());
      postShipment.setPostShipmentRef(transportable.getPostShipment());
      for (Object object : splitted) {
        if (object instanceof Colli) {
          splitColli((Colli) object, postShipment);
        } else {
          splitOrderLine((OrderLine) object, postShipment);
        }
      }
      postShipmentManager.lazyLoad(postShipment,
          new LazyLoadPostShipmentEnum[] {
              LazyLoadPostShipmentEnum.ORDER_LINES,
              LazyLoadPostShipmentEnum.ORDER_LINE_ORDER_LINES });
      if (postShipment.isDonePackage()) {
        postShipment.setPostShipmentReady(Util.getCurrentDate());
      }

      postShipmentManager.savePostShipment(postShipment);
      transportable.setStatus(null);
      saveTransportable(transportable);

      fireSentChange();
    }
View Full Code Here

    }
  }

  private void saveTransportable(Transportable transportable) {
    if (transportable.getPostShipment() != null) {
      PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
          .getBean("postShipmentManager");
      postShipmentManager.savePostShipment((PostShipment) transportable);
    } else {
      try {
        orderViewHandler.getOrderManager().saveOrder(
            (Order) transportable);
      } catch (ProTransException e) {
View Full Code Here

   */
  public static void showMissingColliesForTransportable(
      final Transportable transportable, final WindowInterface window) {
    if (transportable != null) {
      if (transportable instanceof PostShipment) {
        PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
            .getBean("postShipmentManager");
        postShipmentManager
            .lazyLoad(
                (PostShipment) transportable,
                new LazyLoadPostShipmentEnum[] {
                    LazyLoadPostShipmentEnum.ORDER_LINES,
                    LazyLoadPostShipmentEnum.ORDER_LINE_ORDER_LINES,
View Full Code Here

    protected void checkAndSavePostShipment(OrderLine orderLine) {
        PostShipment postShipment = orderLine.getPostShipment();
        if (postShipment != null) {
            postShipment.setStatus(null);
            PostShipmentManager postShipmentManager = (PostShipmentManager) ModelUtil
                    .getBean("postShipmentManager");
            postShipmentManager.savePostShipment(postShipment);
        }
    }
View Full Code Here

TOP

Related Classes of no.ugland.utransprod.service.PostShipmentManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.