ATP restoration on order reject / cancel using webservice.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ATP restoration on order reject / cancel using webservice.

Rajesh Mallah
Hello List ,

When a order is created  ATP becomes ATP - QTY .
When order is cancelled from OOTB ATP is restored back.

I am using webservices to interact with ofbiz and observe that
when i change order status using "changeOrderStatus" webservice call
and set the order status to 'ORDER_REJECTED' or  'ORDER_CANCELLED'
the inventory levels of items (particularly ATP) is not restored back.

as already mentioned cancelling a order from OOTB does restore it
back.

Is there any web service that will do the trick ?

kind regards
Rajesh Mallah.
Reply | Threaded
Open this post in threaded view
|

Re: ATP restoration on order reject / cancel using webservice.

Rajesh Mallah
Sorry a combination of

changeOrderStatus
and
changeOrderItemStatus

does the trick.

thanks.

regds
mallah.




On Sun, Dec 9, 2018 at 9:02 PM Rajesh Mallah <[hidden email]>
wrote:

> Hello List ,
>
> When a order is created  ATP becomes ATP - QTY .
> When order is cancelled from OOTB ATP is restored back.
>
> I am using webservices to interact with ofbiz and observe that
> when i change order status using "changeOrderStatus" webservice call
> and set the order status to 'ORDER_REJECTED' or  'ORDER_CANCELLED'
> the inventory levels of items (particularly ATP) is not restored back.
>
> as already mentioned cancelling a order from OOTB does restore it
> back.
>
> Is there any web service that will do the trick ?
>
> kind regards
> Rajesh Mallah.
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ATP restoration on order reject / cancel using webservice.

Ankush Upadhyay-2
Hello Rajesh,
I believe you can also do the same by calling changeOrderStatus service
only as it has support to change order item status as well. You will have
to pass "setItemStatus" flag as Y.
See *setOrderStatus* implementation:
{code}
if ("Y".equals(context.get("setItemStatus"))) {
            String newItemStatusId = null;
            if ("ORDER_APPROVED".equals(statusId)) {
                newItemStatusId = "ITEM_APPROVED";
            } else if ("ORDER_COMPLETED".equals(statusId)) {
                newItemStatusId = "ITEM_COMPLETED";
            } else if ("ORDER_CANCELLED".equals(statusId)) {
                newItemStatusId = "ITEM_CANCELLED";
            }

            if (newItemStatusId != null) {
                try {
                    Map<String, Object> resp =
dispatcher.runSync("changeOrderItemStatus", UtilMisc.<String,
Object>toMap("orderId", orderId, "statusId", newItemStatusId, "userLogin",
userLogin));
                    if (ServiceUtil.isError(resp)) {
                        return
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
                                "OrderErrorCouldNotChangeItemStatus",
locale) + newItemStatusId, null, null, resp);
                    }
                } catch (GenericServiceException e) {
                    Debug.logError(e, "Error changing item status to " +
newItemStatusId + ": " + e.toString(), module);
                    return
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
                            "OrderErrorCouldNotChangeItemStatus", locale) +
newItemStatusId + ": " + e.toString());
                }
            }
        }
{code}
But as per code, it seems this will only works for "ORDER_APPROVED",
"ORDER_COMPLETED", "ORDER_CANCELLED" but not for "ORDER_REJECTED".
I think this service should have handing for ORDER_REJECTED status as well.

Thanks
--
Ankush Upadhyay


On Sun, Dec 9, 2018 at 9:51 PM Rajesh Mallah <[hidden email]>
wrote:

> Sorry a combination of
>
> changeOrderStatus
> and
> changeOrderItemStatus
>
> does the trick.
>
> thanks.
>
> regds
> mallah.
>
>
>
>
> On Sun, Dec 9, 2018 at 9:02 PM Rajesh Mallah <[hidden email]>
> wrote:
>
> > Hello List ,
> >
> > When a order is created  ATP becomes ATP - QTY .
> > When order is cancelled from OOTB ATP is restored back.
> >
> > I am using webservices to interact with ofbiz and observe that
> > when i change order status using "changeOrderStatus" webservice call
> > and set the order status to 'ORDER_REJECTED' or  'ORDER_CANCELLED'
> > the inventory levels of items (particularly ATP) is not restored back.
> >
> > as already mentioned cancelling a order from OOTB does restore it
> > back.
> >
> > Is there any web service that will do the trick ?
> >
> > kind regards
> > Rajesh Mallah.
> >
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: ATP restoration on order reject / cancel using webservice.

Rajesh Mallah

Thanks a ton.  For the improvement I will try and let you know.


Sent from my Samsung Galaxy smartphone.
-------- Original message --------From: Ankush Upadhyay <[hidden email]> Date: 12/12/2018  15:14  (GMT+05:30) To: [hidden email] Subject: Re: ATP restoration on order reject / cancel using webservice.
Hello Rajesh,
I believe you can also do the same by calling changeOrderStatus service
only as it has support to change order item status as well. You will have
to pass "setItemStatus" flag as Y.
See *setOrderStatus* implementation:
{code}
if ("Y".equals(context.get("setItemStatus"))) {
            String newItemStatusId = null;
            if ("ORDER_APPROVED".equals(statusId)) {
                newItemStatusId = "ITEM_APPROVED";
            } else if ("ORDER_COMPLETED".equals(statusId)) {
                newItemStatusId = "ITEM_COMPLETED";
            } else if ("ORDER_CANCELLED".equals(statusId)) {
                newItemStatusId = "ITEM_CANCELLED";
            }

            if (newItemStatusId != null) {
                try {
                    Map<String, Object> resp =
dispatcher.runSync("changeOrderItemStatus", UtilMisc.<String,
Object>toMap("orderId", orderId, "statusId", newItemStatusId, "userLogin",
userLogin));
                    if (ServiceUtil.isError(resp)) {
                        return
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
                                "OrderErrorCouldNotChangeItemStatus",
locale) + newItemStatusId, null, null, resp);
                    }
                } catch (GenericServiceException e) {
                    Debug.logError(e, "Error changing item status to " +
newItemStatusId + ": " + e.toString(), module);
                    return
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
                            "OrderErrorCouldNotChangeItemStatus", locale) +
newItemStatusId + ": " + e.toString());
                }
            }
        }
{code}
But as per code, it seems this will only works for "ORDER_APPROVED",
"ORDER_COMPLETED", "ORDER_CANCELLED" but not for "ORDER_REJECTED".
I think this service should have handing for ORDER_REJECTED status as well.

Thanks
--
Ankush Upadhyay


On Sun, Dec 9, 2018 at 9:51 PM Rajesh Mallah <[hidden email]>
wrote:

> Sorry a combination of
>
> changeOrderStatus
> and
> changeOrderItemStatus
>
> does the trick.
>
> thanks.
>
> regds
> mallah.
>
>
>
>
> On Sun, Dec 9, 2018 at 9:02 PM Rajesh Mallah <[hidden email]>
> wrote:
>
> > Hello List ,
> >
> > When a order is created  ATP becomes ATP - QTY .
> > When order is cancelled from OOTB ATP is restored back.
> >
> > I am using webservices to interact with ofbiz and observe that
> > when i change order status using "changeOrderStatus" webservice call
> > and set the order status to 'ORDER_REJECTED' or  'ORDER_CANCELLED'
> > the inventory levels of items (particularly ATP) is not restored back.
> >
> > as already mentioned cancelling a order from OOTB does restore it
> > back.
> >
> > Is there any web service that will do the trick ?
> >
> > kind regards
> > Rajesh Mallah.
> >
> >
> >
>