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

Sent from my Samsung Galaxy smartphone.
-------- Original message --------From: Ankush Upadhyay 
<[email protected]> Date: 12/12/2018  15:14  (GMT+05:30) To: 
[email protected] 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 <[email protected]>
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 <[email protected]>
> 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 via email to