同时需要申请一个访问EBS服务器的端口。
(注:端口可用别人已申请好了的也可自己再申请新的)
申请端口:mwactl.sh -login apps/apps start 11444
关闭端口:mwactl.sh -login apps/apps stop_force 11444
根据EBS版本,在Metalink上找到合适的JDeveloper版本,与OAF开发共用 JDeveloper,这里JDeveloper安装包为fmw_12.1.3.0.0_soa_quickstart.jar。
JDeveloper安装后启动JDeveloper,在非主目录下的其他路径中找到JDeveloper解压后的子路径jdevhomejdev子路径jdevhomejdev
如果Win7/8出现显示异常,需要jdevbinjdevbin 下的 f 配置文件,将以下 注释项去掉,AddVMOption -ddraw=true。
在EBS服务器中打包需要的JAVA库,命令如下:
cd $JAVA_TOP
jar -cvf mwa.jar oracle/apps/mwa
jar -cvf fnd.jar oracle/apps/fnd
jar -cvf wms.jar oracle/apps/wms
jar -cvf inv.jar oracle/apps/inv
打包完后该目录下的情况:
将打包好的JAVA文件下载到本地。
安装Oracle主目录 下oracle_commonrdadalib里面就有多种jdbc库文件,使用ojdbc14.jar。
打开JDeveloper,点击File >New >Applications
点击OK,编辑Application Name
点击Next,编辑Project Name
点击Finish。
双击项目MWADemoProject,并导航到Libraries and
Classpath。点击Add Library 和Add Jar/Directory ,分别加入之前打包好的Jar文件和jdbc库文件。
右键项目MWADemoProject,选择New -> Java Class
点击OK
package oracle.apps.cux.demo_11175.server;
import oracle.apps.inv.utilities.server.OrgFunction; public class DemoFunction extends OrgFunction {public DemoFunction() {super(); setFirstPageName("oracle.apps.cux.demo_11175.server.DemoPage");addListener(this); }
}
与创建Function文件的方法一样
修改如下信息:
Name: DemoPage
Package: oracle.apps.cux.demo_11175.server
package oracle.apps.cux.demo_11175.server;
import java.sql.SQLException;
import oracle.apps.inv.utilities.server.UtilFns;
import oracle.apps.mwa.beans.ButtonFieldBean;
import oracle.apps.mwa.beans.LOVFieldBean;
import oracle.apps.mwa.beans.PageBean;
import oracle.apps.mwa.beans.TextFieldBean;
import oracle.ainer.MWALib;
import oracle.ainer.Session;
import oracle.apps.mwa.eventmodel.MWAEvent;
import oracle.apps.mwa.eventmodel.MWAPageListener; public class DemoPage extends PageBean implements MWAPageListener { public DemoPage(Session paramSession) { setSession(paramSession); initLayouts(); initPrompts(); initListeners(); } private void initLayouts() { }private void initPrompts() { } private void initListeners() { }public void pageEntered(MWAEvent mwaEvent) { } public void pageExited(MWAEvent mwaEvent) { }public void specialKeyPressed(MWAEvent mwaEvent) { }
}
private TextFieldBean subinvField; private TextFieldBean locatorField; private LOVFieldBean itemLovField; private TextFieldBean itemDespField; private ButtonFieldBean confirmButton; private ButtonFieldBean cancleButton;private void initLayouts() {this.subinvField = new TextFieldBean();this.subinvField.setName("SUBINV");this.subinvField.setRequired(true); this.locatorField = new TextFieldBean();this.locatorField.setName("LOCATOR");this.locatorField.setRequired(false); this.itemLovField = new LOVFieldBean();this.itemLovField.setName("ITEM");this.itemLovField.setRequired(true); this.itemLovField.setlovStatement("cux_11175_mwa__item_lov");String[] itemLovInputParams = {"","ORGID","oracle.apps.cux.demo_11175.server.DemoPage.SUBINV","oracle.apps.cux.demo_11175.server.DemoPage.LOCATOR","oracle.apps.cux.demo_11175.server.DemoPage.ITEM"};this.itemLovField.setInputParameters(itemLovInputParams); this.itemLovField.setInputParameterTypes(new String[] { "C","N", "S", "S", "S" });this.itemLovField.setSubfieldDisplays(new boolean[] { false, true, true});this.itemLovField.setSubfieldPrompts(new String[] { "a", "物料编码", "物料说明" });this.itemDespField = new TextFieldBean();this.itemDespField.setName("ITEMDESP");this.itemDespField.setRequired(false); this.itemDespField.setEditable(false);firmButton = new ButtonFieldBean();firmButton.setName("CONFIRM"); firmButton.setNextPageName("oracle.apps.cux.demo_11175.server.DemoPage");this.cancleButton = new ButtonFieldBean();this.cancleButton.setName("CANCEL");this.cancleButton.setNextPageName("|END_OF_TRANSACTION|"); this.cancleButton.setEnableAcceleratorKey(true); addFieldBean(this.subinvField); addFieldBean(this.locatorField); addFieldBean(this.itemLovField); addFieldBean(this.itemDespField);firmButton);addFieldBean(this.cancleButton); }
SELECT msiv.inventory_item_atenated_segments,msiv.description
FROM mtl_system_items_vl msiv
WHERE msivanization_id = 组织atenated_segments LIKE 物料编码|| '%'AND EXISTS(SELECT 1FROM mtl_onhand_quantities_detail hoqd,mtl_item_locations_kfv milWHERE hoqdanization_id = msivanization_idAND hoqd.inventory_item_id = msiv.inventory_item_idAND hoqd.subinventory_code = 子库存编码AND hoqdanization_id = milanization_idAND hoqd.locator_id = mil.inventory_location_idAND atenated_segments, '9999') = nvl(货位编码,atenated_segments,'9999')));
private void clears() {if (UtilFns.isTraceOn) ace("In DemoPage clears()");this.subinvField.setValue("");this.locatorField.setValue("");this.itemLovField.setValue("");this.itemDespField.setValue("");if (UtilFns.isTraceOn) ace("In DemoPage clears()");}public void pageEntered(MWAEvent mwaEvent) {clears();
}
private void initPrompts() {if (UtilFns.isTraceOn) ace("In DemoPage initPrompts()");try {AKPrompt(getSession(),acle.apps.wms.utilities.CuxWmsResourceTable", "CUX_DEMO_TITLE") + "(" +getSession().getObject("ORGCODE") + ")");this.subinvField.AKPrompt(getSession(), acle.apps.wms.utilities.CuxWmsResourceTable", "CUX_SUBINVENTORY_PROMPT"));this.locatorField.AKPrompt(getSession(), acle.apps.wms.utilities.CuxWmsResourceTable","CUX_LOCATOR_PROMPT"));this.itemLovField.AKPrompt(getSession(),acle.apps.wms.utilities.CuxWmsResourceTable", "CUX_ITEM_PROMPT"));this.itemDespField.AKPrompt(getSession(), acle.apps.wms.utilities.CuxWmsResourceTable", "CUX_ITEM_DESC_PROMPT"));firmButton.AKPrompt(getSession(), acle.apps.wms.utilities.CuxWmsResourceTable","CUX_CONFIRM_PROMPT"));this.cancleButton.AKPrompt(getSession(), acle.apps.wms.utilities.CuxWmsResourceTable", "CUX_CANCEL_PROMPT"));}catch (SQLException e) {if (UtilFns.isTraceOn) ace("In DemoPage initPrompts() --exception:" + e.getMessage());}if (UtilFns.isTraceOn) ace("Out DemoPage initPrompts()");}
与创建Function文件的方法一样
修改如下信息:
Name: DemoListener
Package: oracle.apps.cux.demo_11175.server
package oracle.apps.cux.demo_11175.server;
import oracle.apps.mwa.beans.FieldBean;
import oracle.ainer.Session;
import oracle.apps.mwa.eventmodel.AbortHandlerException;
import oracle.apps.mwa.eventmodel.DefaultOnlyHandlerException;
import oracle.apps.mwa.eventmodel.InterruptedHandlerException;
import oracle.apps.mwa.eventmodel.MWAEvent;
import oracle.apps.mwa.eventmodel.MWAFieldListener; public class DemoListener implements MWAFieldListener {private DemoPage curPage = null;private Session session = null;public DemoListener(DemoPage demoPage) {this.curPage = demoPage;this.session = Session();}public void fieldEntered(MWAEvent mwaEvent) throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException {}public void fieldExited(MWAEvent mwaEvent) throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException {}
}
在DemoListener文件中验证各字段值
import java.sql.Connection;
import java.sql.SQLException;
import oracle.apps.inv.utilities.server.UtilFns;
import oracle.apps.mwa.beans.FieldBean;
import oracle.jdbc.OracleCallableStatement; public void fieldExited(MWAEvent mwaEvent) throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException {String fieldName = ((FieldBean) Source()).getName();String action = Action();if (UtilFns.isTraceOn) ace("DemoListener:fieldExited for" + fieldName + ",action is " + action);if ((action.equals("MWA_SUBMIT")) || (action.equals("MWA_NEXTFIELD")))if (fieldName.equals(SubinvField().getName())){subinvExited();} else if (fieldName.equals(LocatorField().getName())) {locatorExited();} else if (fieldName.equals(ItemLovField().getName()))itemExited();}private void subinvExited() throws AbortHandlerException {Long organizationId = Long.valueOf(Long.parseLong(Object("ORGID").toString()));String subinvCode = SubinvField().getValue();Connection localConnection = Connection();OracleCallableStatement localOracleCallableStatement = null; try {if (UtilFns.isTraceOn) {ace("calling cux_11175_mwa_demo_pkg.validate_subinv with organizationId:" + organizationId); ace("calling cux_11175_mwa_demo_pkg.validate_subinv with subinvCode:" + subinvCode); }localOracleCallableStatement = (OracleCallableStatement) localConnection.prepareCall("{call cux_11175_mwa_demo_pkg.validate_subinv(:1,:2,:3,:4,:5)}");isterOutParameter(1, 12, 0, 10);isterOutParameter(2, 2);isterOutParameter(3, 12, 0, 4000);localOracleCallableStatement.setLong(4, organizationId.longValue()); localOracleCallableStatement.setString(5, subinvCode);uteQuery();String returnStatus = String(1); String returnMsg = String(3); if (returnStatus.equalsIgnoreCase("S")) {if (UtilFns.ace("Success from validate_subinv Transaction Number:" + subinvCode); } else {this.session.setStatusMessage(returnMsg); if (UtilFns.isTraceOn) {ace("Failure from validate_subinv:" + returnMsg); }}try {if (localOracleCallableStatement != null) localOracleCallableStatement.close();} catch (SQLException e) {if (UtilFns.ace("Exception when closing localOracleCallableStatement" + e.getMessage());throw new AbortHandlerException("Exception when closing localOracleCallableStatement");}} catch (Exception localSQLException) {throw new AbortHandlerException("SQL error validate_subinv ");} finally {try {if (localOracleCallableStatement != null) localOracleCallableStatement.close();} catch (SQLException e) {if (UtilFns.isTraceOn) ace("Exception when closing localOracleCallableStatement " + e.getMessage()); throw new AbortHandlerException("Exception when closing localOracleCallableStatement");}}}private void locatorExited() throws AbortHandlerException {Long organizationld = Long.valueOf(Long.parseLong(Object("ORGID").toString()));String subinvCode = SubinvField().getValue();String locatorCode = LocatorField().getValue();Connection localConnection = Connection();OracleCallableStatement loraclecallablestatment = null; try {if (UtilFns.isTraceOn) {ace("calling cux_11175_mwa_demo_pkg.validate_locator with organizationId:" + organizationld);ace("calling cux_11175_mwa_demo_pkg.validate_locator with subinvCode:" + subinvCode); ace("calling cux_11175_mwa_demo_pkg.validate_locator with lcaotorCode:" + locatorCode); }loraclecallablestatment = (OracleCallableStatement) localConnection.prepareCall("{call cux_11175_mwa_demo_pkg.validate_locator(:1,:2,:3,:4,:5,:6)}");isterOutParameter(1, 12, 0, 10);isterOutParameter(2,2); isterOutParameter(3, 12, 0, 4000);loraclecallablestatment.setLong(4,organizationld.longValue());loraclecallablestatment.setString(5, subinvCode);loraclecallablestatment.setString(6, locatorCode);uteQuery();String returnStatus = String(1); String returnMsg = String(3); if (returnStatus.equalsIgnoreCase("S")) {if (UtilFns.ace("Success from validate_subinv Transaction Number:" + subinvCode); } else {this.session.setStatusMessage(returnMsg);if (UtilFns.isTraceOn) {ace("Failure from validate_subinv:" + returnMsg); }}try {if (loraclecallablestatment != null) loraclecallablestatment.close();} catch (SQLException e) {if (UtilFns.ace("Exception when closing localOracleCallableStatement" + e.getMessage());throw new AbortHandlerException("Exception when closing localOracleCallableStatement");}} catch (Exception localSQLException) {throw new AbortHandlerException("SQL error validate_subinv ");} finally {try {if (loraclecallablestatment != null) loraclecallablestatment.close();} catch (SQLException e) {if (UtilFns.ace("Exception when closing localOracleCallableStatement " + e.getMessage());throw new AbortHandlerException("Exception when closing localOracleCallableStatement");}}}private void itemExited() throws AbortHandlerException {if (ItemLovField().isPopulated()) ItemDespField().setValue(ItemLovField().getSelectedValues().elementAt(2).toString());}
验证子库信息
SELECT COUNT(1)
FROM mtl_secondary_inventories msi
WHERE msianization_id = 组织ID
AND msi.secondary_inventory_name = 子库编码
验证货位信息
SELECT COUNT(1)
FROM mtl_item_locations_kfv mil
WHERE milanization_id = 组织ID
AND mil.subinventory_code = 子库编码
atenated_segments = 货位编码;
注:一定要初始化FieldListener,否则将不会执行字段验证相关函数
private DemoListener mListener = null; private void initListeners() {this.mListener = new DemoListener(this);this.subinvField.addListener(this.mListener);this.locatorField.addListener(this.mListener);this.itemLovField.addListener(this.mListener);firmButton.addListener(this.mListener);this.cancleButton.addListener(this.mListener);addListener(this);}public void setSubinvField(TextFieldBean subinvField) {this.subinvField = subinvField; }public TextFieldBean getSubinvField() {return this.subinvField; }public void setItemLovField(LOVFieldBean itemLovField) {this.itemLovField = itemLovField; }public LOVFieldBean getItemLovField() {return this.itemLovField; }public void setItemDespField(TextFieldBean itemDespField) {this.itemDespField = itemDespField; }public TextFieldBean getItemDespField() {return this.itemDespField; }public void setLocatorField(TextFieldBean locatorField) {this.locatorField = locatorField; }public TextFieldBean getLocatorField() {return this.locatorField; }
1、 右键MWAAppDemo.jws或MWAAppDemo.jpr,Rebuild
2、 将<JDEV_USER_HOME>myworkMWAAppDemoMWADemoProjectClasses/oracle/apps/cux/demo_11175
上传到服务器$JAVA_TOP//oracle/apps/cux/demo_11175
3、 修改目录属性,cd $JAVA_TOP后运行:chmod -R 775 hand
在打开MWA客户端之前,需要重启端口;在MWA开发过程中,任何修改都需要重启端口才能生效
cd $ADMIN_SCRIPTS_HOME
mwactl.sh –login apps/apps stop_force 11444
mwactl.sh –login apps/apps start 11444
与挂form方式一样,注意个别选项的值即可。
特性菜单下
类型:移动应用产品
WebHtml菜单下
HTML调用:oracle.apps.cux.demo_11175.server.DemoFunction
然后将功能挂到对应需求的菜单和职责之下。
本文发布于:2024-02-04 22:24:42,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170717775660201.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |