My goal is to write an ECA service that prints
component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF to a LAN printer when an order status becomes "Order Approved. Could y'all help me through this? I'm starting in /soft/ofbiz/applications/order/servicedef/secas.xml where I'm adding a new ECA: <!-- order status changes --> ... <eca service="changeOrderStatus" event="commit" run-on-error="false"> <condition field-name="statusId" operator="equals" value="ORDER_APPROVED"/> <action service="sendShipGroupToPrinter" mode="sync"/> </eca> am I on the right track? -- David Shere Information Technology Services Steele Rubber Products www.SteeleRubber.com |
Okay now I've added the following. Is this close to being right?
********************** /soft/ofbiz/applications/order/servicedef/services.xml --------------------------------------------- <service name="sendShipGroupToPrinter" engine="java" location="org.ofbiz.order.order.OrderServices" invoke="sendShipGroupToPrinter" auth="true"> <description>Sends a picking ticket to the shipping department. Generally called by ECA rule.</description> <attribute name="orderId" type="String" mode="IN" optional="false"/> </service> ************************* /soft/ofbiz/applications/order/src/org/ofbiz/order/order/OrderServices.java ------------------------------------------------- public static Map sendShipGroupToPrinter (DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); Map screenInMap = UtilMisc.toMap("orderId", context.get("orderId")); String printerName = "//somePrinterNameToBeFilledInLater"; Map outMap = UtilMisc.toMap( "screenLocation", "component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF", "printerName", printerName, "userLogin", userLogin, "screenContext", screenInMap ); dispatcher.runAsync("sendPrintFromScreen", inMap); return ServiceUtil.returnSuccess(); } David Shere wrote: > My goal is to write an ECA service that prints > component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF to a > LAN printer when an order status becomes "Order Approved. Could y'all > help me through this? > > I'm starting in /soft/ofbiz/applications/order/servicedef/secas.xml > where I'm adding a new ECA: > > <!-- order status changes --> > ... > <eca service="changeOrderStatus" event="commit" run-on-error="false"> > <condition field-name="statusId" operator="equals" > value="ORDER_APPROVED"/> > <action service="sendShipGroupToPrinter" mode="sync"/> > </eca> > > am I on the right track? -- David Shere Information Technology Services Steele Rubber Products www.SteeleRubber.com |
There shouldn't be a need to create a java method or additional service
here. Just specify the screenLocation in the service eca and call the existing service. <eca service="changeOrderStatus" event="commit" run-on-error="false"> <condition field-name="statusId" operator="equals" value="ORDER_APPROVED"/> <set field="screenLocation" value="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF"/> <action service="sendPrintFromScreen" mode="sync"/> </eca> --- David Shere <[hidden email]> wrote: > Okay now I've added the following. Is this close to being right? > > ********************** > /soft/ofbiz/applications/order/servicedef/services.xml > --------------------------------------------- > <service name="sendShipGroupToPrinter" engine="java" > location="org.ofbiz.order.order.OrderServices" > invoke="sendShipGroupToPrinter" auth="true"> > <description>Sends a picking ticket to the shipping > department. > Generally called by ECA rule.</description> > <attribute name="orderId" type="String" mode="IN" > optional="false"/> > </service> > > ************************* > > ------------------------------------------------- > public static Map sendShipGroupToPrinter (DispatchContext dctx, > Map > context) { > GenericDelegator delegator = dctx.getDelegator(); > LocalDispatcher dispatcher = dctx.getDispatcher(); > GenericValue userLogin = (GenericValue) > context.get("userLogin"); > Locale locale = (Locale) context.get("locale"); > > Map screenInMap = UtilMisc.toMap("orderId", > context.get("orderId")); > String printerName = "//somePrinterNameToBeFilledInLater"; > Map outMap = UtilMisc.toMap( > "screenLocation", > > "printerName", printerName, > "userLogin", userLogin, > "screenContext", screenInMap > ); > dispatcher.runAsync("sendPrintFromScreen", inMap); > return ServiceUtil.returnSuccess(); > } > > David Shere wrote: > > My goal is to write an ECA service that prints > > component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF > to a > > LAN printer when an order status becomes "Order Approved. Could > y'all > > help me through this? > > > > I'm starting in /soft/ofbiz/applications/order/servicedef/secas.xml > > > where I'm adding a new ECA: > > > > <!-- order status changes --> > > ... > > <eca service="changeOrderStatus" event="commit" > run-on-error="false"> > > <condition field-name="statusId" operator="equals" > > value="ORDER_APPROVED"/> > > <action service="sendShipGroupToPrinter" mode="sync"/> > > </eca> > > > > am I on the right track? > > -- > David Shere > Information Technology Services > Steele Rubber Products > www.SteeleRubber.com > > |
forgot to add the orderId to the context...
screenContext.orderId <eca service="changeOrderStatus" event="commit" run-on-error="false"> <condition field-name="statusId" operator="equals" value="ORDER_APPROVED"/> <set field-name="screenContext.orderId" env-name="orderId"/> <set field="screenLocation" value="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF"/> <action service="sendPrintFromScreen" mode="sync"/> </eca> --- Chris Howe <[hidden email]> wrote: > There shouldn't be a need to create a java method or additional > service > here. Just specify the screenLocation in the service eca and call > the > existing service. > > <eca service="changeOrderStatus" event="commit" run-on-error="false"> > <condition field-name="statusId" operator="equals" > value="ORDER_APPROVED"/> <set field-name="screenContext.orderId" env-name="orderId"/> > <set field="screenLocation" > value="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF"/> > <action service="sendPrintFromScreen" mode="sync"/> > </eca> > > > > --- David Shere <[hidden email]> wrote: > > > Okay now I've added the following. Is this close to being right? > > > > ********************** > > /soft/ofbiz/applications/order/servicedef/services.xml > > --------------------------------------------- > > <service name="sendShipGroupToPrinter" engine="java" > > location="org.ofbiz.order.order.OrderServices" > > invoke="sendShipGroupToPrinter" auth="true"> > > <description>Sends a picking ticket to the shipping > > department. > > Generally called by ECA rule.</description> > > <attribute name="orderId" type="String" mode="IN" > > optional="false"/> > > </service> > > > > ************************* > > > > > ------------------------------------------------- > > public static Map sendShipGroupToPrinter (DispatchContext > dctx, > > Map > > context) { > > GenericDelegator delegator = dctx.getDelegator(); > > LocalDispatcher dispatcher = dctx.getDispatcher(); > > GenericValue userLogin = (GenericValue) > > context.get("userLogin"); > > Locale locale = (Locale) context.get("locale"); > > > > Map screenInMap = UtilMisc.toMap("orderId", > > context.get("orderId")); > > String printerName = "//somePrinterNameToBeFilledInLater"; > > Map outMap = UtilMisc.toMap( > > "screenLocation", > > > > > "printerName", printerName, > > "userLogin", userLogin, > > "screenContext", screenInMap > > ); > > dispatcher.runAsync("sendPrintFromScreen", inMap); > > return ServiceUtil.returnSuccess(); > > } > > > > David Shere wrote: > > > My goal is to write an ECA service that prints > > > > component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF > > to a > > > LAN printer when an order status becomes "Order Approved. Could > > y'all > > > help me through this? > > > > > > I'm starting in > /soft/ofbiz/applications/order/servicedef/secas.xml > > > > > where I'm adding a new ECA: > > > > > > <!-- order status changes --> > > > ... > > > <eca service="changeOrderStatus" event="commit" > > run-on-error="false"> > > > <condition field-name="statusId" operator="equals" > > > value="ORDER_APPROVED"/> > > > <action service="sendShipGroupToPrinter" mode="sync"/> > > > </eca> > > > > > > am I on the right track? > > > > -- > > David Shere > > Information Technology Services > > Steele Rubber Products > > www.SteeleRubber.com > > > > > > |
Thanks! sendPrintFromScreen also needs printerName and contentType.
Would I do that like this? <set field="contentType" value="application/pdf"/> <set field="printerName" value="//SomePrinterNameToBeFilledInLater"/> Chris Howe wrote: > forgot to add the orderId to the context... > screenContext.orderId > > <eca service="changeOrderStatus" event="commit" run-on-error="false"> > <condition field-name="statusId" operator="equals" > value="ORDER_APPROVED"/> > <set field-name="screenContext.orderId" env-name="orderId"/> > <set field="screenLocation" > value="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF"/> > <action service="sendPrintFromScreen" mode="sync"/> > </eca> > > --- Chris Howe <[hidden email]> wrote: > >> There shouldn't be a need to create a java method or additional >> service >> here. Just specify the screenLocation in the service eca and call >> the >> existing service. >> >> <eca service="changeOrderStatus" event="commit" run-on-error="false"> >> <condition field-name="statusId" operator="equals" >> value="ORDER_APPROVED"/> > <set field-name="screenContext.orderId" env-name="orderId"/> >> <set field="screenLocation" >> > value="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF"/> >> <action service="sendPrintFromScreen" mode="sync"/> >> </eca> >> >> >> >> --- David Shere <[hidden email]> wrote: >> >>> Okay now I've added the following. Is this close to being right? >>> >>> ********************** >>> /soft/ofbiz/applications/order/servicedef/services.xml >>> --------------------------------------------- >>> <service name="sendShipGroupToPrinter" engine="java" >>> location="org.ofbiz.order.order.OrderServices" >>> invoke="sendShipGroupToPrinter" auth="true"> >>> <description>Sends a picking ticket to the shipping >>> department. >>> Generally called by ECA rule.</description> >>> <attribute name="orderId" type="String" mode="IN" >>> optional="false"/> >>> </service> >>> >>> ************************* >>> > /soft/ofbiz/applications/order/src/org/ofbiz/order/order/OrderServices.java >>> ------------------------------------------------- >>> public static Map sendShipGroupToPrinter (DispatchContext >> dctx, >>> Map >>> context) { >>> GenericDelegator delegator = dctx.getDelegator(); >>> LocalDispatcher dispatcher = dctx.getDispatcher(); >>> GenericValue userLogin = (GenericValue) >>> context.get("userLogin"); >>> Locale locale = (Locale) context.get("locale"); >>> >>> Map screenInMap = UtilMisc.toMap("orderId", >>> context.get("orderId")); >>> String printerName = "//somePrinterNameToBeFilledInLater"; >>> Map outMap = UtilMisc.toMap( >>> "screenLocation", >>> > "component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF", >>> "printerName", printerName, >>> "userLogin", userLogin, >>> "screenContext", screenInMap >>> ); >>> dispatcher.runAsync("sendPrintFromScreen", inMap); >>> return ServiceUtil.returnSuccess(); >>> } >>> >>> David Shere wrote: >>>> My goal is to write an ECA service that prints >>>> >> component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF >>> to a >>>> LAN printer when an order status becomes "Order Approved. Could >>> y'all >>>> help me through this? >>>> >>>> I'm starting in >> /soft/ofbiz/applications/order/servicedef/secas.xml >>>> where I'm adding a new ECA: >>>> >>>> <!-- order status changes --> >>>> ... >>>> <eca service="changeOrderStatus" event="commit" >>> run-on-error="false"> >>>> <condition field-name="statusId" operator="equals" >>>> value="ORDER_APPROVED"/> >>>> <action service="sendShipGroupToPrinter" mode="sync"/> >>>> </eca> >>>> >>>> am I on the right track? >>> -- >>> David Shere >>> Information Technology Services >>> Steele Rubber Products >>> www.SteeleRubber.com >>> >>> >> > > -- David Shere Information Technology Services Steele Rubber Products www.SteeleRubber.com |
Yes, that should work.
--- David Shere <[hidden email]> wrote: > Thanks! sendPrintFromScreen also needs printerName and contentType. > Would I do that like this? > > > <set field="contentType" value="application/pdf"/> > <set field="printerName" > value="//SomePrinterNameToBeFilledInLater"/> > > > Chris Howe wrote: > > forgot to add the orderId to the context... > > screenContext.orderId > > > > <eca service="changeOrderStatus" event="commit" > run-on-error="false"> > > <condition field-name="statusId" operator="equals" > > value="ORDER_APPROVED"/> > > <set field-name="screenContext.orderId" env-name="orderId"/> > > <set field="screenLocation" > > > > > <action service="sendPrintFromScreen" mode="sync"/> > > </eca> > > > > --- Chris Howe <[hidden email]> wrote: > > > >> There shouldn't be a need to create a java method or additional > >> service > >> here. Just specify the screenLocation in the service eca and call > >> the > >> existing service. > >> > >> <eca service="changeOrderStatus" event="commit" > run-on-error="false"> > >> <condition field-name="statusId" operator="equals" > >> value="ORDER_APPROVED"/> > > <set field-name="screenContext.orderId" > env-name="orderId"/> > >> <set field="screenLocation" > >> > > > > >> <action service="sendPrintFromScreen" mode="sync"/> > >> </eca> > >> > >> > >> > >> --- David Shere <[hidden email]> wrote: > >> > >>> Okay now I've added the following. Is this close to being right? > >>> > >>> ********************** > >>> /soft/ofbiz/applications/order/servicedef/services.xml > >>> --------------------------------------------- > >>> <service name="sendShipGroupToPrinter" engine="java" > >>> location="org.ofbiz.order.order.OrderServices" > >>> invoke="sendShipGroupToPrinter" auth="true"> > >>> <description>Sends a picking ticket to the shipping > >>> department. > >>> Generally called by ECA rule.</description> > >>> <attribute name="orderId" type="String" mode="IN" > >>> optional="false"/> > >>> </service> > >>> > >>> ************************* > >>> > > > > >>> ------------------------------------------------- > >>> public static Map sendShipGroupToPrinter (DispatchContext > >> dctx, > >>> Map > >>> context) { > >>> GenericDelegator delegator = dctx.getDelegator(); > >>> LocalDispatcher dispatcher = dctx.getDispatcher(); > >>> GenericValue userLogin = (GenericValue) > >>> context.get("userLogin"); > >>> Locale locale = (Locale) context.get("locale"); > >>> > >>> Map screenInMap = UtilMisc.toMap("orderId", > >>> context.get("orderId")); > >>> String printerName = > "//somePrinterNameToBeFilledInLater"; > >>> Map outMap = UtilMisc.toMap( > >>> "screenLocation", > >>> > > > > >>> "printerName", printerName, > >>> "userLogin", userLogin, > >>> "screenContext", screenInMap > >>> ); > >>> dispatcher.runAsync("sendPrintFromScreen", inMap); > >>> return ServiceUtil.returnSuccess(); > >>> } > >>> > >>> David Shere wrote: > >>>> My goal is to write an ECA service that prints > >>>> > >> > component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF > >>> to a > >>>> LAN printer when an order status becomes "Order Approved. Could > >>> y'all > >>>> help me through this? > >>>> > >>>> I'm starting in > >> /soft/ofbiz/applications/order/servicedef/secas.xml > >>>> where I'm adding a new ECA: > >>>> > >>>> <!-- order status changes --> > >>>> ... > >>>> <eca service="changeOrderStatus" event="commit" > >>> run-on-error="false"> > >>>> <condition field-name="statusId" operator="equals" > >>>> value="ORDER_APPROVED"/> > >>>> <action service="sendShipGroupToPrinter" mode="sync"/> > >>>> </eca> > >>>> > >>>> am I on the right track? > >>> -- > >>> David Shere > >>> Information Technology Services > >>> Steele Rubber Products > >>> www.SteeleRubber.com > >>> > >>> > >> > > > > > > -- > David Shere > Information Technology Services > Steele Rubber Products > www.SteeleRubber.com > > |
Hmm... I'm getting this:
2007-03-23 15:11:24,369 (http-0.0.0.0-8443-Processor4) [ ModelService.java:414:ERROR] [ModelService.validate] : {sendPrintFromScreen} : (IN) Required test error: org.ofbiz.service.ServiceValidationException: The following required parameter is missing: [sendPrintFromScreen.screenLocation] 2007-03-23 15:11:24,373 (http-0.0.0.0-8443-Processor4) [ ServiceDispatcher.java:326:ERROR] ---- exception report ---------------------------------------------------------- Incoming context (in runSync : sendPrintFromScreen) does not match expected requirements Exception: org.ofbiz.service.ServiceValidationException Message: The following required parameter is missing: [sendPrintFromScreen.screenLocation] ---- stack trace --------------------------------------------------------------- org.ofbiz.service.ServiceValidationException: The following required parameter is missing: [sendPrintFromScreen.screenLocation] Chris Howe wrote: > Yes, that should work. > --- David Shere <[hidden email]> wrote: > >> Thanks! sendPrintFromScreen also needs printerName and contentType. >> Would I do that like this? >> >> >> <set field="contentType" value="application/pdf"/> >> <set field="printerName" >> value="//SomePrinterNameToBeFilledInLater"/> >> >> >> Chris Howe wrote: >>> forgot to add the orderId to the context... >>> screenContext.orderId >>> >>> <eca service="changeOrderStatus" event="commit" >> run-on-error="false"> >>> <condition field-name="statusId" operator="equals" >>> value="ORDER_APPROVED"/> >>> <set field-name="screenContext.orderId" env-name="orderId"/> >>> <set field="screenLocation" >>> > value="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF"/> >>> <action service="sendPrintFromScreen" mode="sync"/> >>> </eca> >>> >>> --- Chris Howe <[hidden email]> wrote: >>> >>>> There shouldn't be a need to create a java method or additional >>>> service >>>> here. Just specify the screenLocation in the service eca and call >>>> the >>>> existing service. >>>> >>>> <eca service="changeOrderStatus" event="commit" >> run-on-error="false"> >>>> <condition field-name="statusId" operator="equals" >>>> value="ORDER_APPROVED"/> >>> <set field-name="screenContext.orderId" >> env-name="orderId"/> >>>> <set field="screenLocation" >>>> > value="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF"/> >>>> <action service="sendPrintFromScreen" mode="sync"/> >>>> </eca> >>>> >>>> >>>> >>>> --- David Shere <[hidden email]> wrote: >>>> >>>>> Okay now I've added the following. Is this close to being right? >>>>> >>>>> ********************** >>>>> /soft/ofbiz/applications/order/servicedef/services.xml >>>>> --------------------------------------------- >>>>> <service name="sendShipGroupToPrinter" engine="java" >>>>> location="org.ofbiz.order.order.OrderServices" >>>>> invoke="sendShipGroupToPrinter" auth="true"> >>>>> <description>Sends a picking ticket to the shipping >>>>> department. >>>>> Generally called by ECA rule.</description> >>>>> <attribute name="orderId" type="String" mode="IN" >>>>> optional="false"/> >>>>> </service> >>>>> >>>>> ************************* >>>>> > /soft/ofbiz/applications/order/src/org/ofbiz/order/order/OrderServices.java >>>>> ------------------------------------------------- >>>>> public static Map sendShipGroupToPrinter (DispatchContext >>>> dctx, >>>>> Map >>>>> context) { >>>>> GenericDelegator delegator = dctx.getDelegator(); >>>>> LocalDispatcher dispatcher = dctx.getDispatcher(); >>>>> GenericValue userLogin = (GenericValue) >>>>> context.get("userLogin"); >>>>> Locale locale = (Locale) context.get("locale"); >>>>> >>>>> Map screenInMap = UtilMisc.toMap("orderId", >>>>> context.get("orderId")); >>>>> String printerName = >> "//somePrinterNameToBeFilledInLater"; >>>>> Map outMap = UtilMisc.toMap( >>>>> "screenLocation", >>>>> > "component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF", >>>>> "printerName", printerName, >>>>> "userLogin", userLogin, >>>>> "screenContext", screenInMap >>>>> ); >>>>> dispatcher.runAsync("sendPrintFromScreen", inMap); >>>>> return ServiceUtil.returnSuccess(); >>>>> } >>>>> >>>>> David Shere wrote: >>>>>> My goal is to write an ECA service that prints >>>>>> >> component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF >>>>> to a >>>>>> LAN printer when an order status becomes "Order Approved. Could >>>>> y'all >>>>>> help me through this? >>>>>> >>>>>> I'm starting in >>>> /soft/ofbiz/applications/order/servicedef/secas.xml >>>>>> where I'm adding a new ECA: >>>>>> >>>>>> <!-- order status changes --> >>>>>> ... >>>>>> <eca service="changeOrderStatus" event="commit" >>>>> run-on-error="false"> >>>>>> <condition field-name="statusId" operator="equals" >>>>>> value="ORDER_APPROVED"/> >>>>>> <action service="sendShipGroupToPrinter" mode="sync"/> >>>>>> </eca> >>>>>> >>>>>> am I on the right track? >>>>> -- >>>>> David Shere >>>>> Information Technology Services >>>>> Steele Rubber Products >>>>> www.SteeleRubber.com >>>>> >>>>> >>> >> -- >> David Shere >> Information Technology Services >> Steele Rubber Products >> www.SteeleRubber.com >> >> > > -- David Shere Information Technology Services Steele Rubber Products www.SteeleRubber.com |
Free forum by Nabble | Edit this page |