@Override
 public String execute(final ConsignmentProcessModel process) {
   final ConsignmentModel consignment = process.getConsignment();
   if (consignment != null) {
     consignment.setStatus(ConsignmentStatus.PICKUP_COMPLETE);
     getModelService().save(consignment);
     return Transition.OK.toString();
   }
   LOG.error("Process has no consignment");
   return Transition.ERROR.toString();
 }
 @Override
 protected void onSiteEvent(final SendReadyForPickupMessageEvent sendReadyForPickupMessageEvent) {
   final ConsignmentModel consignmentModel =
       sendReadyForPickupMessageEvent.getProcess().getConsignment();
   final ConsignmentProcessModel consignmentProcessModel =
       getBusinessProcessService()
           .createProcess(
               "telcoSendReadyForPickupEmailProcess-"
                   + consignmentModel.getCode()
                   + "-"
                   + System.currentTimeMillis(),
               "telcoSendReadyForPickupEmailProcess");
   consignmentProcessModel.setConsignment(consignmentModel);
   getModelService().save(consignmentProcessModel);
   getBusinessProcessService().startProcess(consignmentProcessModel);
 }
  @Override
  public void prepareConsignment(final ConsignmentModel consignment) {
    for (final ConsignmentEntryModel consignmentEntries : consignment.getConsignmentEntries()) {
      consignmentEntries.setShippedQuantity(consignmentEntries.getQuantity());
    }
    consignment.setStatus(ConsignmentStatus.READY);
    getModelService().save(consignment);

    final Thread warehouse =
        new Thread(
            new Warehouse(
                Registry.getCurrentTenant().getTenantID(), consignment.getPk().getLongValue()));
    warehouse.start();

    try {
      Thread.sleep(3000);
    } catch (final InterruptedException e) {
      // nothing to do
    }
  }
 @Override
 public String execute(final ConsignmentProcessModel process) {
   final ConsignmentModel consignment = process.getConsignment();
   if (consignment != null) {
     try {
       // Check if the Order is Cancelled
       if (OrderStatus.CANCELLED.equals(consignment.getOrder().getStatus())
           || OrderStatus.CANCELLING.equals(consignment.getOrder().getStatus())) {
         return Transition.CANCEL.toString();
       } else {
         getProcess2WarehouseAdapter().shipConsignment(process.getConsignment());
         if (consignment.getDeliveryMode() instanceof PickUpDeliveryModeModel) {
           return Transition.PICKUP.toString();
         } else {
           return Transition.DELIVERY.toString();
         }
       }
     } catch (final Exception e) {
       return Transition.ERROR.toString();
     }
   }
   return Transition.ERROR.toString();
 }
 @Override
 public void receiveConsignmentStatus(
     final ConsignmentModel consignment, final WarehouseConsignmentStatus status) {
   for (final ConsignmentProcessModel process : consignment.getConsignmentProcesses()) {
     final WarehouseConsignmentState state = getStatusMap().get(status);
     if (state == null) {
       throw new RuntimeException("No mapping for WarehouseConsignmentStatus: " + status);
     }
     process.setWarehouseConsignmentState(state);
     getModelService().save(process);
     getBusinessProcessService()
         .triggerEvent(
             process.getCode() + "_" + OctcommonFulfilmentProcessConstants.WAIT_FOR_WAREHOUSE);
   }
 }
 @Override
 public void shipConsignment(final ConsignmentModel consignment) {
   if (consignment == null) {
     LOG.error("No consignment to ship");
   } else {
     if (consignment.getDeliveryMode() instanceof PickUpDeliveryModeModel) {
       consignment.setStatus(ConsignmentStatus.READY_FOR_PICKUP);
     } else {
       consignment.setStatus(ConsignmentStatus.SHIPPED);
     }
     consignment.setShippingDate(getTimeService().getCurrentTime());
     for (final ConsignmentEntryModel entry : consignment.getConsignmentEntries()) {
       entry.setShippedQuantity(entry.getOrderEntry().getQuantity());
       getModelService().save(entry);
     }
     getModelService().save(consignment);
     if (LOG.isInfoEnabled()) {
       LOG.info("Consignment [" + consignment.getCode() + "] shipped");
     }
   }
 }
Ejemplo n.º 7
0
 @Override
 public void afterSplitting(final Object groupingObject, final ConsignmentModel consignmentModel) {
   consignmentModel.setDeliveryPointOfService((PointOfServiceModel) groupingObject);
 }
Ejemplo n.º 8
0
 @Override
 public void afterSplitting(final Object groupingObject, final ConsignmentModel createdOne) {
   createdOne.setDeliveryMode((DeliveryModeModel) groupingObject);
 }