Class CancelAndReplaceUtils


  • public class CancelAndReplaceUtils
    extends Object
    • Constructor Detail

      • CancelAndReplaceUtils

        public CancelAndReplaceUtils()
    • Method Detail

      • createReplacementOrder

        public static Order createReplacementOrder​(Order oldOrder)
        Process that creates a replacement order in temporary status in order to Cancel and Replace an original order
        Parameters:
        oldOrder - Order that will be cancelled and replaced
      • createReplacementOrder

        public static List<Order> createReplacementOrder​(Order oldOrder,
                                                         Map<Warehouse,​Integer> warehouseMap)
        Process that creates a replacement order in temporary status in order to Cancel and Replace an original order
        Parameters:
        oldOrder - Order that will be cancelled and replaced
        warehouseMap - Map with the list of Warehouses where the replacements will be created and the number of replacements to create in each one
      • cancelOrder

        public static Order cancelOrder​(String oldOrderId,
                                        org.codehaus.jettison.json.JSONObject jsonOrder,
                                        boolean useOrderDocumentNoForRelatedDocs)
        Method that given an Order Id it cancels it and creates another one equal but with negative quantities.
        Parameters:
        oldOrderId - Id of the Sales Order to be cancelled.
        jsonOrder - Parameter with order information coming from Web POS.
        useOrderDocumentNoForRelatedDocs - flag coming from Web POS. If it is true, it will set the same document of the order to netting payment.
      • cancelOrder

        public static Order cancelOrder​(String oldOrderId,
                                        String paymentOrganizationId,
                                        org.codehaus.jettison.json.JSONObject jsonOrder,
                                        boolean useOrderDocumentNoForRelatedDocs)
        Method that given an Order Id it cancels it and creates another one equal but with negative quantities.
        Parameters:
        oldOrderId - Id of the Sales Order to be cancelled.
        jsonOrder - Parameter with order information coming from Web POS.
        useOrderDocumentNoForRelatedDocs - flag coming from Web POS. If it is true, it will set the same document of the order to netting payment.
      • cancelAndReplaceOrder

        public static Order cancelAndReplaceOrder​(String newOrderId,
                                                  org.codehaus.jettison.json.JSONObject jsonOrder,
                                                  boolean useOrderDocumentNoForRelatedDocs)
        Method that given an Order Id it cancels it and creates another one equal but with negative quantities. It also creates a new order replacing the cancelled one.
        Parameters:
        newOrderId - Id of the replacement Sales Order.
        jsonOrder - Parameter with order information coming from Web POS
        useOrderDocumentNoForRelatedDocs - . flag coming from Web POS. If it is true, it will set the same document of the order to netting payment.
      • cancelAndReplaceOrder

        public static Order cancelAndReplaceOrder​(String newOrderId,
                                                  String paymentOrganizationId,
                                                  org.codehaus.jettison.json.JSONObject jsonOrder,
                                                  boolean useOrderDocumentNoForRelatedDocs)
        Method that given an Order Id it cancels it and creates another one equal but with negative quantities. It also creates a new order replacing the cancelled one.
        Parameters:
        newOrderId - Id of the replacement Sales Order.
        jsonOrder - Parameter with order information coming from Web POS
        useOrderDocumentNoForRelatedDocs - . flag coming from Web POS. If it is true, it will set the same document of the order to netting payment.
      • cancelAndReplaceOrder

        public static List<Order> cancelAndReplaceOrder​(String oldOrderId,
                                                        Set<String> newOrderIds,
                                                        String paymentOrganizationId,
                                                        org.codehaus.jettison.json.JSONObject jsonOrder,
                                                        boolean useOrderDocumentNoForRelatedDocs)
        Method that given an Order Id it cancels it and creates another one equal but with negative quantities. It also creates a new order replacing the cancelled one.
        Parameters:
        oldOrderId - Id of the Sales Order to be cancelled.
        newOrderIds - Set of IDs of the replacement Sales Orders.
        jsonOrder - Parameter with order information coming from Web POS
        useOrderDocumentNoForRelatedDocs - . flag coming from Web POS. If it is true, it will set the same document of the order to netting payment.
      • getNextCancelDocNo

        public static String getNextCancelDocNo​(String documentNo)
        Process that generates a document number for an order which cancels another order.
        Parameters:
        documentNo - Document number of the cancelled order.
        Returns:
        The new document number for the order which cancels the old order.
      • getCreateNettingGoodsShipmentPreferenceValue

        public static boolean getCreateNettingGoodsShipmentPreferenceValue​(Order order)
        Method to check if a netting shipment must be generated during the C&R and CL process.
        Parameters:
        order - The order that is being canceled.
        Returns:
        True if is necessary to create the netting shipment.
      • getAssociateGoodsShipmentToNewSalesOrderPreferenceValue

        public static boolean getAssociateGoodsShipmentToNewSalesOrderPreferenceValue​(Order order)
        Method to check if during the C&R process the shipment lines must be moved from the old order to the new order.
        Parameters:
        order - The order that is being canceled.
        Returns:
        True if the shipment lines must be moved to the new order.
      • getDeliveryQtySetAsZeroWhenCancelLayaway

        public static boolean getDeliveryQtySetAsZeroWhenCancelLayaway​(Order order)
        Method to check if during the C&R process, the original order and reverse order's delivered quantity should be updated with ordered quantity
        Parameters:
        order - The order that is being canceled.
        Returns:
        boolean