public void save(Connection conn, String welfarefundId) throws SQLException { CallableStatement cstmt = null; try { String sql = "begin HR_WLF_WELFARE_PKG.SAVE_EMPOLYEE_TYPE(:1,:2,:3,:4); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); cstmt.setString(1, Decoder.convertSetString(welfarefundId)); cstmt.setString(2, Decoder.convertSetString(this.getCurrentEmployeeType().getAttributeId())); cstmt.registerOutParameter(3, Types.INTEGER); cstmt.registerOutParameter(4, Types.VARCHAR); cstmt.execute(); int returnCode = cstmt.getInt(3); String returnMessage = cstmt.getString(4); DeBug.print("in Save : the returnCode : " + returnCode); DeBug.print("in Save : the returnMessage : " + returnMessage); } finally { try { cstmt.close(); cstmt = null; } catch (Exception e) { } } }
public int doStartTag() throws JspException { try { DeBug.print("****MfgStatusTag*****"); eOrderMgr = (EOrderMgr) pageContext.getSession().getAttribute("eOrderMgr"); orderDetail = eOrderMgr.getCurrentOrder().getCurrentOrderDetail(); pageContext.setAttribute( "orderDetail", orderDetail.getOrderDetail() == null ? "" : orderDetail.getOrderDetail()); DeBug.print("****orderDetail*****" + orderDetail.getOrderDetail()); pageContext.setAttribute( "order", orderDetail.getOrderNo() == null ? "" : orderDetail.getOrderNo()); pageContext.setAttribute( "bldPart", orderDetail.getTrcPart() == null || orderDetail.getTrcPart().getPnCode() == null ? "" : orderDetail.getTrcPart().getPnCode()); pageContext.setAttribute( "dueDate", orderDetail.getRequiredDate() == null ? "" : orderDetail.getRequiredDate()); pageContext.setAttribute( "assignQty", orderDetail.getQty() == null ? "" : orderDetail.getQty()); pageContext.setAttribute( "weight", orderDetail.getWeight() == null ? "" : orderDetail.getWeight()); pageContext.setAttribute( "priority", orderDetail.getPriority() == null ? "" : orderDetail.getPriority()); // pageContext.setAttribute("isSaved", material.isSaved()? "Y" : "N"); } catch (Exception e) { e.printStackTrace(); } return Tag.EVAL_BODY_INCLUDE; }
/* Business type 2 */ public void saveQuoteItemDtl(QuotationMgr quotationMgr, Connection conn, String quoteId) throws SQLException { CallableStatement cstmt = null; try { this.mCode = 0; conn.setAutoCommit(false); String sql = "begin OM_QUOTATION_PKG.SAVE_QUOTE_ITEM_DTL(:1,:2,:3,:4,:5,:6,:7,:8,:9); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); if (quoteId == null || quoteId.equals("")) return; cstmt.setString(1, Decoder.convertSetString(quoteId)); cstmt.setNull(2, Types.VARCHAR); cstmt.setString(3, Decoder.convertSetString(this.getCustomerId())); cstmt.setString(4, Decoder.convertSetString(this.getCurrentSite().getSiteId())); cstmt.setString(5, Decoder.convertSetString(this.getCurrentContact().getContactId())); cstmt.setString(6, Decoder.convertSetString(this.getQuotePrice())); cstmt.setString(7, Decoder.convertSetString("CREATE")); cstmt.registerOutParameter(2, Types.VARCHAR); cstmt.registerOutParameter(8, Types.INTEGER); cstmt.registerOutParameter(9, Types.INTEGER); cstmt.execute(); int returnCode = cstmt.getInt(8); String returnMessage = cstmt.getString(9); DeBug.print(String.valueOf(returnCode), "(in Save : the returnCode )"); DeBug.print(returnMessage, "(in Save : the returnMessage )"); if (returnCode != 0) { // Non-manageable error. conn.rollback(); this.mCode = SAVE_ERROR; } else { this.setQuoteDtlId(cstmt.getString(2)); } } catch (Exception e) { conn.rollback(); e.printStackTrace(); this.mCode = SAVE_ERROR; } finally { try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
/** * others method ** */ public void save() throws SQLException { Connection conn = OracleGate.getConnection(); CallableStatement cstmt = null; this.mCode = 0; try { conn.setAutoCommit(false); String sql = "begin BOM_PARAMETER_PKG.SAVE_PARAMETER(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10); end;"; DeBug.print(sql); cstmt = conn.prepareCall(sql); cstmt.setString(1, this.getWeightBase()); cstmt.setString(2, this.getPacking()); cstmt.setString(3, this.getElectrolysis()); cstmt.setString(4, this.getManagement()); cstmt.setString(5, this.getSaraly()); cstmt.setString(6, this.getScript()); cstmt.setString(7, this.getAssemblybase()); cstmt.setString(8, this.getProfit()); cstmt.registerOutParameter(9, Types.INTEGER); cstmt.registerOutParameter(10, Types.VARCHAR); cstmt.execute(); int returnCode = cstmt.getInt(9); String returnMessage = cstmt.getString(10); DeBug.print(" returnCode ::" + returnCode); DeBug.print(" returnMessage ::" + returnMessage); if (returnCode == -2) { // Violate unique constraint in database conn.rollback(); this.mCode = UNIQUE_VIOLATION; } else if (returnCode != 0) { // Non-manageable error. conn.rollback(); this.mCode = SAVE_ERROR; } else { conn.commit(); } } catch (Exception e) { conn.rollback(); e.printStackTrace(); this.mCode = SAVE_ERROR; } finally { conn.setAutoCommit(true); if (conn != null) { OracleGate.freeConnection(conn); } try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
private String getFilename(String fullname) { String filename = null; DeBug.print("filename : " + fullname); fullname = fullname.replace('\\', '/'); StringTokenizer token = new StringTokenizer(fullname, "/"); while (token.hasMoreTokens()) { filename = token.nextToken(); } DeBug.print("Decoder.convertSetString(filename) : " + Decoder.convertSetString(filename)); return Decoder.convertSetString(filename); }
/* Business type 2 */ public void saveStatus(QuotationMgr quotationMgr) throws SQLException { Connection conn = null; conn = OracleGate.getConnection(); CallableStatement cstmt = null; System.out.println("Quotation detail id : " + this.getQuoteDtlId()); try { this.mCode = 0; conn.setAutoCommit(false); String sql = "begin OM_QUOTATION_PKG.SAVE_QUOTE_ITEM_STATUS(:1,:2,:3); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); cstmt.setString(1, Decoder.convertSetString(this.getQuoteDtlId())); cstmt.registerOutParameter(2, Types.INTEGER); cstmt.registerOutParameter(3, Types.INTEGER); cstmt.execute(); int returnCode = cstmt.getInt(2); String returnMessage = cstmt.getString(3); DeBug.print(String.valueOf(returnCode), "(in Save : the returnCode )"); DeBug.print(returnMessage, "(in Save : the returnMessage )"); if (returnCode != 0) { // Non-manageable error. conn.rollback(); this.mCode = SAVE_ERROR; } else { conn.commit(); } } catch (Exception e) { conn.rollback(); e.printStackTrace(); this.mCode = SAVE_ERROR; } finally { conn.setAutoCommit(true); if (conn != null) { OracleGate.freeConnection(conn); } try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
public int saveMemo(Connection conn, Login login) throws SQLException { CallableStatement cstmt = null; try { this.mCode = 0; String sql = "begin FM_AR_SEND_TO_FM_PKG.SAVE_CREDIT_MEMO_TO_GL(:1,:2,:3,:4,:5); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); int returnCode; String returnMessage; cstmt.setString(1, this.getMemoId()); cstmt.setString(2, Decoder.convertSetString(login.getLoginName())); cstmt.registerOutParameter(3, Types.VARCHAR); cstmt.registerOutParameter(4, Types.INTEGER); cstmt.registerOutParameter(5, Types.VARCHAR); cstmt.execute(); returnCode = cstmt.getInt(4); returnMessage = cstmt.getString(5); DeBug.print(returnCode + ":" + returnMessage); if (returnCode != 0) { this.mCode = SAVE_ERROR; return this.mCode; } else if (returnCode == -5) { this.mCode = TAX_ID_NOT_FOUND; return this.mCode; } else if (returnCode != 0) { this.mCode = SAVE_ERROR; return this.mCode; } else { this.setVoucherNo(cstmt.getString(3)); this.setIsSavedFlag("Y"); return this.mCode; } } catch (Exception e) { this.mCode = SAVE_ERROR; e.printStackTrace(); throw new SQLException(e.getMessage()); } finally { if (cstmt != null) { cstmt.close(); } cstmt = null; } }
public void refreshFactory(Connection conn) throws SQLException { StringBuffer sqlBuffer = new StringBuffer(); sqlBuffer.append(" SELECT PLANT_ID, PLANT_CODE, PLANT_NAME, DESCRIPTION "); sqlBuffer.append(" FROM INV_PLANT_CATALOG "); sqlBuffer.append(" WHERE NVL(DISABLED_FLAG,'N') = 'N' "); sqlBuffer.append(" ORDER BY 2 "); DeBug.print(sqlBuffer.toString()); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = conn.prepareStatement(sqlBuffer.toString()); rs = pstmt.executeQuery(); this.getFactoryList().clear(); while (rs.next()) { SelectionOption factoryLocation = new SelectionOption(); factoryLocation.setAttributeId(Decoder.convertGetString(rs.getString(1))); factoryLocation.setAttributeCode(Decoder.convertGetString(rs.getString(2))); factoryLocation.setAttributeName(Decoder.convertGetString(rs.getString(3))); factoryLocation.setDescription(Decoder.convertGetString(rs.getString(4))); this.getFactoryList().add(factoryLocation); } } catch (Exception e) { e.printStackTrace(); } finally { try { pstmt.close(); pstmt = null; rs.close(); rs = null; } catch (Exception e) { } } }
public void saveCreditMemoToGL(Connection conn, Login login) throws SQLException { CallableStatement cstmt = null; try { this.mCode = 0; // conn.setAutoCommit(false); String sql = "begin FM_AP_SEND_TO_FM_PKG.SAVE_CREDIT_MEMO_TO_GL(:1,:2,:3,:4,:5); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); int returnCode; String returnMessage; cstmt.setString(1, this.getMemoId()); cstmt.setString(2, Decoder.convertSetString(login.getLoginName())); cstmt.registerOutParameter(3, Types.VARCHAR); cstmt.registerOutParameter(4, Types.INTEGER); cstmt.registerOutParameter(5, Types.VARCHAR); cstmt.execute(); returnCode = cstmt.getInt(4); returnMessage = cstmt.getString(5); DeBug.print("returnCode :" + returnCode); DeBug.print("returnMessage :" + returnMessage); if (returnCode == -2) { // Violate unique constraint in database this.mCode = UNIQUE_VIOLATION; throw new SQLException(returnMessage); } else if (returnCode != 0) { // Non-manageable error. this.mCode = SAVE_ERROR; throw new SQLException(returnMessage); } } catch (Exception e) { this.mCode = SAVE_ERROR; e.printStackTrace(); throw new SQLException(e.getMessage()); } finally { if (cstmt != null) { cstmt.close(); } cstmt = null; } }
public void saveCloseEO2(Connection conn, String reportId) throws SQLException { CallableStatement cstmt = null; try { this.mCode = 0; String sql = "begin OM_REPORT_PKG.EO_REPORT(:1,:2,:3,:4); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); // eoReportMgr.setReportId(null); int returnCode; String returnMessage; cstmt.setString(1, Decoder.convertSetString(this.getEoDetailId())); cstmt.setString(2, reportId); cstmt.registerOutParameter(3, Types.INTEGER); cstmt.registerOutParameter(4, Types.VARCHAR); cstmt.execute(); returnCode = cstmt.getInt(3); returnMessage = cstmt.getString(4); DeBug.print(String.valueOf(returnCode), "(in Save : the returnCode )"); DeBug.print(returnMessage, "(in Save : the returnMessage )"); if (returnCode == -2) { // Violate unique constraint in database this.mCode = UNIQUE_VIOLATION; throw new SQLException(returnMessage); } else if (returnCode != 0) { // Non-manageable error. this.mCode = SAVE_ERROR; throw new SQLException(returnMessage); } } catch (Exception e) { this.mCode = SAVE_ERROR; throw new SQLException(e.getMessage()); } finally { try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
public int doStartTag() throws JspException { ResignMgr resignMgr = (ResignMgr) pageContext.getSession().getAttribute("resignMgr"); Resign resign = resignMgr.getCurrentResign(); if (resign == null) { DeBug.print("resign Null"); return Tag.SKIP_BODY; } pageContext.setAttribute( "expectResignDate", resign.getExpectResignDate() == null ? "" : resign.getExpectResignDate()); pageContext.setAttribute( "actualResignDate", resign.getActualResignDate() == null ? "" : resign.getActualResignDate()); pageContext.setAttribute( "reason", resign.getDescription() == null ? "" : resign.getDescription()); pageContext.setAttribute("isSavedResign", resign.isSaved() ? "Y" : "N"); pageContext.setAttribute( "expectResignDateError", resign.isValid("expectResignDate") ? "" : resign.getMessage("expectResignDate")); pageContext.setAttribute( "actualResignDateError", resign.isValid("actualResignDate") ? "" : resign.getMessage("actualResignDate")); pageContext.setAttribute("specialLeaveDays", resign.getSpecialLeaveDays()); pageContext.setAttribute( "specialLeaveDaysError", resign.isValid("specialLeaveDays") ? "" : resign.getMessage("specialLeaveDays")); pageContext.setAttribute("specialLeaveHours", resign.getSpecialLeaveHours()); pageContext.setAttribute( "specialLeaveHoursError", resign.isValid("specialLeaveHours") ? "" : resign.getMessage("specialLeaveHours")); pageContext.setAttribute("dayOrHour", resign.getDayOrHour()); pageContext.setAttribute( "dayOrHourError", resign.isValid("dayOrHour") ? "" : resign.getMessage("dayOrHour")); // pageContext.setAttribute("employeeStatusError", // resign.isValid("employeeStatusError")?"":resign.getMessage("employeeStatusError")); // pageContext.setAttribute("employeeStatusError", // resign.isValid("employeeStatus.attributeCode")?"":resign.getMessage("employeeStatus.attributeCode")); ResignEmployee employee = resignMgr.getCurrentResignEmployee(); if (employee == null) employee = new ResignEmployee(); pageContext.setAttribute("employeeId", resign.getResignEmployee().getAttributeId()); pageContext.setAttribute("employeeCode", resign.getResignEmployee().getAttributeCode()); pageContext.setAttribute( "employeeName", resign.getResignEmployee().getEmployeeDomesticName() == null ? "" : resign.getResignEmployee().getEmployeeDomesticName()); pageContext.setAttribute( "employeeEnglishName", resign.getResignEmployee().getEmployeeEnglishName() == null ? "" : resign.getResignEmployee().getEmployeeEnglishName()); return EVAL_BODY_INCLUDE; }
public void savePaymentTermDetail(Connection conn, String poNo) throws SQLException { CallableStatement cstmt = null; try { this.mCode = 0; String sql = "begin PUR_PO_PKG.SAVE_PAYMENT_TERM(:1,:2,:3,:4,:5); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); int returnCode; String returnMessage; cstmt.setString(1, poNo); cstmt.setString(2, this.getPaymentTerm().getAttributeId()); cstmt.setString(3, getPercentage()); cstmt.registerOutParameter(4, Types.INTEGER); cstmt.registerOutParameter(5, Types.VARCHAR); cstmt.execute(); returnCode = cstmt.getInt(4); returnMessage = cstmt.getString(5); DeBug.print(String.valueOf(returnCode), "(in Save : the returnCode )"); DeBug.print(returnMessage, "(in Save : the returnMessage )"); if (returnCode == -2) { // Violate unique constraint in database this.mCode = UNIQUE_VIOLATION; throw new SQLException(returnMessage); } else if (returnCode != 0) { // Non-manageable error. this.mCode = SAVE_ERROR; throw new SQLException(returnMessage); } } catch (Exception e) { this.mCode = SAVE_ERROR; throw new SQLException(e.getMessage()); } finally { if (cstmt != null) { cstmt.close(); } cstmt = null; } }
public void save(Connection conn) throws SQLException { CallableStatement cstmt = null; try { String sql = "begin OM_MOLDING_CHARGE_PKG.MODIFY_MOLDING_CHARGE_RETURNED(:1,:2,:3,:4); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); cstmt.setString(1, Decoder.convertSetString(this.getEoDetailId())); cstmt.setString(2, Decoder.convertSetString(this.getIsReturned() ? "Y" : "N")); DeBug.print(getIsReturned() ? "OK" : "SORRY"); cstmt.registerOutParameter(3, Types.INTEGER); cstmt.registerOutParameter(4, Types.VARCHAR); cstmt.execute(); int returnCode = cstmt.getInt(3); String returnMessage = cstmt.getString(4); DeBug.print(String.valueOf(returnCode), "(in Save : the returnCode )"); DeBug.print(returnMessage, "(in Save : the returnMessage )"); if (returnCode == -2) { // Violate unique constraint in database // this.mCode = UNIQUE_VIOLATION; throw new SQLException(returnMessage); } else if (returnCode != 0) { // Non-manageable error. // this.mCode = SAVE_ERROR; throw new SQLException(returnMessage); } } catch (Exception e) { // this.mCode = SAVE_ERROR; throw new SQLException(e.getMessage()); } finally { try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
public int doStartTag() throws JspException { salarydataMgr = (SalaryDataMaintainMgr) pageContext.getSession().getAttribute("salaryDataMgr"); DeBug.print( "*********size=" + salarydataMgr.getCurrentIncomeTaxType().getIncomeTaxTypeList().size()); iterator = salarydataMgr.getCurrentIncomeTaxType().getIncomeTaxTypeList().iterator(); if (salarydataMgr.getCurrentIncomeTaxType().getIncomeTaxTypeList().size() == 0) { return SKIP_BODY; } return IterationTag.EVAL_BODY_AGAIN; }
public void saveUpdateWoFactory(Connection conn) throws SQLException { CallableStatement cstmt = null; try { // this.mCode = 0; String sql = "begin MFG_WO_PKG.MODIFY_WO_FACTORY(:1,:2,:3,:4); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); if (this.getWoId() == null) cstmt.setNull(1, Types.VARCHAR); else cstmt.setString(1, Decoder.convertSetString(this.getWoId())); cstmt.setString(2, this.getSelectFactory().getAttributeId()); cstmt.registerOutParameter(3, Types.INTEGER); cstmt.registerOutParameter(4, Types.VARCHAR); cstmt.execute(); int returnCode = cstmt.getInt(3); String returnMessage = cstmt.getString(4); DeBug.print("in Save : the returnCode : ****" + returnCode); DeBug.print("in Save : the returnMessage : ****" + returnMessage); if (returnCode == -2) { // Violate unique constraint in database // this.mCode = UNIQUE_VIOLATION; throw new SQLException(returnMessage); } else if (returnCode != 0) { // Non-manageable error. // this.mCode = SAVE_ERROR; throw new SQLException(returnMessage); } } catch (Exception e) { // this.mCode = SAVE_ERROR; e.printStackTrace(); throw new SQLException(e.getMessage()); } finally { if (cstmt != null) { cstmt.close(); } cstmt = null; } }
public void save(Connection conn, AccountingArMgr accMgr, int rowIndex) throws SQLException { CallableStatement cstmt = null; String verbEntryMode = accMgr.getEntryMode().split("-")[0]; try { this.mCode = 0; String sql = "begin FM_AR_PAYMENT_TERM_DETAIL_PKG.SAVE(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); cstmt.setLong(1, Long.parseLong(accMgr.getCurrentMiscellaneousInvoice().getInvoiceId())); cstmt.setLong(2, Long.parseLong(this.getPaymentTerm().getAttributeCode())); cstmt.setDouble(3, Double.parseDouble(this.getPercentage())); cstmt.setString( 4, Decoder.convertSetString(accMgr.getCurrentMiscellaneousInvoice().getStartDate())); cstmt.setNull(5, Types.VARCHAR); cstmt.setNull(6, Types.VARCHAR); cstmt.setString( 7, Decoder.convertSetString(accMgr.getCurrentMiscellaneousInvoice().getSourceType())); cstmt.setString(8, Decoder.convertSetString(verbEntryMode)); cstmt.setLong(9, rowIndex); cstmt.registerOutParameter(10, Types.INTEGER); cstmt.registerOutParameter(11, Types.VARCHAR); cstmt.execute(); int returnCode = cstmt.getInt(10); String returnMessage = cstmt.getString(11); if (returnCode == -2) { // Violate unique constraint in database this.mCode = UNIQUE_VIOLATION; throw new SQLException(returnMessage); } else if (returnCode != 0) { // Non-manageable error. this.mCode = SAVE_ERROR; throw new SQLException(returnMessage); } } catch (Exception e) { this.mCode = SAVE_ERROR; e.printStackTrace(); throw new SQLException(e.getMessage()); } finally { if (cstmt != null) { cstmt.close(); } cstmt = null; } }
// refresh public void refreshRawMaterialList() throws SQLException { this.getRawMaterialList().clear(); PreparedStatement pstmt = null; ResultSet rs = null; StringBuffer sqlBuffer = new StringBuffer(); Connection conn = OracleGate.getConnection(); try { sqlBuffer.append(" SELECT IP.PART_ID, IP.PART_CODE, IP.PART_NAME, "); sqlBuffer.append(" IP.UOM_ID, GI.RM_UNIT_COST,GI.RM_QTY,"); sqlBuffer.append(" GI.RM_SUB_TOTAL, GI.RM_LOCATION_ID "); sqlBuffer.append(" FROM ITEM_PART IP,GOS_ITEM GI "); sqlBuffer.append(" WHERE IP.PART_ID = GI.RM_ID "); sqlBuffer.append(" ORDER BY PART_CODE "); DeBug.print(sqlBuffer.toString()); pstmt = conn.prepareStatement(sqlBuffer.toString()); rs = pstmt.executeQuery(); while (rs.next()) { RawMaterial rawMaterial = new RawMaterial(); rawMaterial.setRmId(Decoder.convertGetString(rs.getString(1))); rawMaterial.setRmCode(Decoder.convertGetString(rs.getString(2))); rawMaterial.setRmName(Decoder.convertGetString(rs.getString(3))); rawMaterial.setUom(Decoder.convertGetString(rs.getString(4))); Item item = new Item(); item.setRmUnitCost(Decoder.convertGetString(rs.getString(6))); item.setRmQty(Decoder.convertGetString(rs.getString(7))); item.setRmSubtotal(Decoder.convertGetString(rs.getString(8))); item.setLocation(Decoder.convertGetString(rs.getString(9))); this.getRawMaterialList().add(rawMaterial); } } catch (Exception e) { e.printStackTrace(); } finally { try { OracleGate.freeConnection(conn); pstmt.close(); pstmt = null; rs.close(); rs = null; } catch (Exception e) { } } }
protected void forwardView( String actionEvent, String actionObject, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { OutMgr outMgr = (OutMgr) this.getManagerFromSession(request); DeBug.print("actionObject" + actionObject); if (outMgr.getEntryMode().equals("VIEW_OUTSOURCING_STOCK")) { getServletContext() .getRequestDispatcher("/jsp/mfg/inv/viewOutsourcingStock.jsp") .forward(request, response); } else if (outMgr.getEntryMode().equals("VIEW_MATERIAL")) { getServletContext() .getRequestDispatcher("/jsp/mfg/inv/viewMaterial.jsp") .forward(request, response); } }
public void save(Connection conn, String partId, String processId, Login login) throws SQLException, SQLException { CallableStatement cstmt = null; try { String sql = "begin ITEM_PART_PKG.SAVE_ITEM_MACHINE_DETAIL(:1,:2,:3,:4,:5,:6,:7); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); cstmt.setString(1, Decoder.convertSetString(partId)); cstmt.setString(2, Decoder.convertSetString(processId)); cstmt.setString(3, Decoder.convertSetString(this.getMachineType().getAttributeId())); cstmt.setString(4, Decoder.convertSetString(this.getProductionRate())); cstmt.setString(5, Decoder.convertSetString(this.isIsMajor() ? "Y" : "N")); cstmt.registerOutParameter(6, Types.INTEGER); cstmt.registerOutParameter(7, Types.VARCHAR); cstmt.execute(); int returnCode = cstmt.getInt(6); String returnMessage = cstmt.getString(7); if (returnCode == -2) { // Violate unique constraint in database this.mCode = UNIQUE_VIOLATION; throw new SQLException(returnMessage); } else if (returnCode != 0) { // Non-manageable error. this.mCode = SAVE_ERROR; throw new SQLException(returnMessage); } } catch (Exception e) { this.mCode = SAVE_ERROR; e.printStackTrace(); throw new SQLException(e.getMessage()); } finally { if (cstmt != null) { cstmt.close(); } cstmt = null; } }
/* methods */ public void populateCurrency(QuotationMgr quotationMgr) throws SQLException { Connection conn = null; conn = com.cynosure.common.sql.OracleGate.getConnection(); StringBuffer sql = new StringBuffer(); sql.append(" select cur.currency_id, cur.currency_code, cur.currency_name "); sql.append(" from gm_currency cur, mod_customer cus "); sql.append(" where cus.customer_id = :1 "); sql.append(" and cur.currency_id = cus.currency_id "); DeBug.print(sql.toString()); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = conn.prepareStatement(sql.toString()); pstmt.setString(1, Decoder.convertSetString(getCustomerId())); rs = pstmt.executeQuery(); while (rs.next()) { Currency currency = new Currency(); currency.setAttributeId(Decoder.convertGetString((rs.getString(1)))); currency.setAttributeCode(Decoder.convertGetString((rs.getString(2)))); currency.setAttributeName(Decoder.convertGetString((rs.getString(3)))); setCurrency(currency); } } finally { if (conn != null) { OracleGate.freeConnection(conn); } try { if (pstmt != null) { pstmt.close(); } pstmt = null; rs.close(); rs = null; } catch (Exception e) { e.printStackTrace(); } } }
public String populateQuerytList(MVCMgr mvcMgr, Login login) throws Exception { // System.out.println(" populateQuerytList com.laconic.pur.po.component;"); StringBuffer sqlBuffer = new StringBuffer(); if (mvcMgr.getFoundMode().equals(Constant.FIND_VENDOR)) { if (((PoMgr) mvcMgr).getEntryMode().equals(Constant.CREATE_QUICK_PO)) { sqlBuffer.append(" SELECT PV.VENDOR_CODE, PV.VENDOR_NAME, PV.BIO_ADDRESS, "); sqlBuffer.append(" PV.PRESIDENT, PV.WEB_SITE, PV.BIO_TEL1, "); sqlBuffer.append(" PV.BIO_TEL2, PV.BIO_TEL3, PV.BIO_FAX1, "); sqlBuffer.append(" PV.BIO_FAX2, PV.BIO_FAX3, PV.COUNTRY, "); sqlBuffer.append(" PV.PAYMENT_TERM, PV.CREDIT_LINE, PV.TURNOVER, "); sqlBuffer.append(" PV.NO_OF_EMPLOYEE, PV.ESTABLISHED_YEAR, PV.MAJOR_MARKET, "); sqlBuffer.append(" PV.IMPORT, PV.EXPORT, PV.OTHER_GROUP_COMPANIES, "); sqlBuffer.append(" PV.TOTAL_CAPACITY, PV.REMARK, NULL, "); sqlBuffer.append(" PV.GROUP_CODE, PV.VENDOR_ID, PV.PAYMENT_TERM_ID, "); sqlBuffer.append( " PV.TAX_ID, DECODE((SELECT VALUE FROM FM_GL_INIT_PARAMETER WHERE NAME = 'COUNTRY'),PV.COUNTRY_ID,'L','I'), "); sqlBuffer.append(" PV.DELIVERY_TERM_ID, NVL(PV.MAJOR_SUPPLIER_FLAG,'N') "); sqlBuffer.append(" FROM PUR_VENDOR PV "); sqlBuffer.append(" WHERE 1 = 1 "); sqlBuffer.append( " AND (EXISTS (SELECT 'O' FROM PUR_VENDOR_PART PVP WHERE PVP.VENDOR_ID = PV.VENDOR_ID ) "); sqlBuffer.append(" OR NVL(PV.MAJOR_SUPPLIER_FLAG,'N') = 'Y' ) "); sqlBuffer.append(" AND NVL(PV.STATUS,'E') = 'E'"); this.isRearchCondition(sqlBuffer); if (!this.isHaveOrderBy(sqlBuffer)) { sqlBuffer.append(" ORDER BY VENDOR_CODE "); } } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_CONTACT)) { sqlBuffer.append(" SELECT PC.CONTACT_ID, PC.CONTACT_CODE, PC.CONTACT_PERSON_NAME, "); sqlBuffer.append(" PC.MOBILE, PC.E_MAIL, PC.TITLE, "); sqlBuffer.append(" PVF.FACTORY_CODE, PVF.F_ADDRESS, PVF.F_TEL1, "); sqlBuffer.append( " PVF.F_FAX1, DECODE((SELECT VALUE FROM FM_GL_INIT_PARAMETER WHERE NAME = 'COUNTRY'),PVF.F_COUNTRY_ID,'L','I') "); sqlBuffer.append(" FROM PUR_CONTACT PC, "); sqlBuffer.append(" PUR_VENDOR_FACTORY PVF "); sqlBuffer.append(" WHERE PC.VENDOR_ID = "); sqlBuffer.append(((PoMgr) mvcMgr).getCurrentPurchaseOrder().getVendor().getVendorId()); sqlBuffer.append(" AND PVF.FACTORY_ID = PC.FACTORY_ID "); // sqlBuffer.append(" AND PC.FLAG = 'V' "); this.isRearchCondition(sqlBuffer); if (!this.isHaveOrderBy(sqlBuffer)) { sqlBuffer.append(" ORDER BY 2 "); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_PO_PART)) { sqlBuffer.append(" SELECT NULL A, NULL B, 0 C, "); sqlBuffer.append(" NULL D, PVP.DESCRIPTION, NULL E, "); sqlBuffer.append(" IP.PART_ID, IP.PART_CODE, IP.PART_NAME, "); sqlBuffer.append(" IP.PART_FULL_NAME, IP.PART_PRODUCTION_TYPE_ID, IPT.PART_CATEGORY, "); sqlBuffer.append(" IU.UOM_ID, IU.UOM_CODE, IU.UOM_NAME, "); sqlBuffer.append(" NVL(PVP.PRICE_UNIT,0), PVP.CURRENCY, IP.CREATED_BY, "); sqlBuffer.append(" IPT.PART_TYPE_CODE, VENDOR_PART_CODE, VENDOR_PART_NAME, "); sqlBuffer.append(" IPT.PART_TYPE_ID, IPT.PART_TYPE_NAME "); sqlBuffer.append(" FROM ITEM_UOM IU, "); sqlBuffer.append(" ITEM_PART_TYPE IPT, "); sqlBuffer.append(" ITEM_PART IP, "); sqlBuffer.append(" (SELECT * FROM PUR_VENDOR_PART WHERE VENDOR_ID = "); sqlBuffer.append(((PoMgr) mvcMgr).getCurrentPurchaseOrder().getVendor().getVendorId()); sqlBuffer.append(" ) PVP "); sqlBuffer.append(" WHERE IP.ORDERABLE_FLAG = 'Y' "); sqlBuffer.append(" AND NVL(IP.TEMPLATE_ITEM_FLAG,'N') = 'N' "); if (((PoMgr) mvcMgr).getCurrentPurchaseOrder().getVendor().isMajorSupplier()) { sqlBuffer.append(" AND IP.PART_ID = PVP.PART_ID(+) "); } else { sqlBuffer.append(" AND IP.PART_ID = PVP.PART_ID "); } sqlBuffer.append(" AND IP.PART_TYPE_ID = IPT.PART_TYPE_ID(+) "); sqlBuffer.append(" AND IU.UOM_ID = IP.UOM_ID "); /* Part type code filter */ sqlBuffer.append(" AND IPT.PART_TYPE_ID = IP.PART_TYPE_ID "); if (((PoMgr) mvcMgr).getPartTypeFromString() != null && !((PoMgr) mvcMgr).getPartTypeFromString().equals("")) { sqlBuffer.append( " AND IPT.PART_TYPE_CODE >= '" + ((PoMgr) mvcMgr).getPartTypeFromString() + "' "); } if (((PoMgr) mvcMgr).getPartTypeToString() != null && !((PoMgr) mvcMgr).getPartTypeToString().equals("")) { sqlBuffer.append( " AND IPT.PART_TYPE_CODE <= '" + ((PoMgr) mvcMgr).getPartTypeToString() + "' "); } /* Part physical dimension filter */ if (((PoMgr) mvcMgr).getFromWidth() != null && ((PoMgr) mvcMgr).getFromWidth().matches("^(?=.+)(?:[1-9]\\d*|0)?(?:\\.\\d+)?$")) { sqlBuffer.append(" AND NVL(IP.UNIT_WIDTH,0) >= " + ((PoMgr) mvcMgr).getFromWidth()); } if (((PoMgr) mvcMgr).getToWidth() != null && ((PoMgr) mvcMgr).getToWidth().matches("^(?=.+)(?:[1-9]\\d*|0)?(?:\\.\\d+)?$")) { sqlBuffer.append(" AND NVL(IP.UNIT_WIDTH,0) <= " + ((PoMgr) mvcMgr).getToWidth()); } if (((PoMgr) mvcMgr).getFromLength() != null && !((PoMgr) mvcMgr).getFromLength().equals("")) { if (((PoMgr) mvcMgr).getFromLength().matches("^(?=.+)(?:[1-9]\\d*|0)?(?:\\.\\d+)?$")) { sqlBuffer.append(" AND IP.UNIT_LENGTH >= " + ((PoMgr) mvcMgr).getFromLength()); if (((PoMgr) mvcMgr).getToLength() != null && ((PoMgr) mvcMgr).getToLength().matches("^(?=.+)(?:[1-9]\\d*|0)?(?:\\.\\d+)?$")) { sqlBuffer.append(" AND IP.UNIT_LENGTH <= " + ((PoMgr) mvcMgr).getToLength()); } } else { sqlBuffer.append(" AND IP.UNIT_LENGTH IS NULL "); } } if (((PoMgr) mvcMgr).getFromThickness() != null && ((PoMgr) mvcMgr).getFromThickness().matches("^(?=.+)(?:[1-9]\\d*|0)?(?:\\.\\d+)?$")) { sqlBuffer.append(" AND NVL(IP.UNIT_HEIGHT,0) >= " + ((PoMgr) mvcMgr).getFromThickness()); } if (((PoMgr) mvcMgr).getToThickness() != null && ((PoMgr) mvcMgr).getToThickness().matches("^(?=.+)(?:[1-9]\\d*|0)?(?:\\.\\d+)?$")) { sqlBuffer.append(" AND NVL(IP.UNIT_HEIGHT,0) <= " + ((PoMgr) mvcMgr).getToThickness()); } if (ParameterUtil.isItemSeparatedByFactory) { sqlBuffer.append( " AND EXISTS (SELECT 'O' FROM ITEM_PART_FACTORY IPF WHERE IPF.PART_ID = IP.PART_ID AND IPF.FACTORY_ID = " + login.getEmployee().getFactoryId() + " ) "); } this.isRearchCondition(sqlBuffer); if (!this.isHaveOrderBy(sqlBuffer)) { sqlBuffer.append(" ORDER BY IP.PART_CODE "); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_PART) || mvcMgr.getFoundMode().equals(Constant.FIND_FOC_PART)) { sqlBuffer.append(" SELECT IP.PART_ID, IP.PART_CODE, IP.PART_NAME, "); sqlBuffer.append(" IP.PART_FULL_NAME, IP.COMPLETE_NAME, IP.PART_DESCRIPTION, "); sqlBuffer.append(" IPT.PART_CATEGORY, IP.STD_PURCHASE_UNIT_COST,IP.LEAD_TIME, "); sqlBuffer.append(" IP.UOM_ID,IU.UOM_CODE ,IU.UOM_NAME, "); sqlBuffer.append(" IP.PART_TYPE_ID, IPT.PART_TYPE_CODE,IPT.PART_TYPE_NAME, "); sqlBuffer.append(" IP.LOCATION_ID, PVP.VENDOR_PART_CODE, PVP.VENDOR_PART_NAME "); sqlBuffer.append(" FROM "); sqlBuffer.append(" ITEM_UOM IU, "); sqlBuffer.append(" ITEM_PART_TYPE IPT, "); sqlBuffer.append(" ITEM_PART IP, "); sqlBuffer.append(" (SELECT * FROM PUR_VENDOR_PART WHERE VENDOR_ID = "); sqlBuffer.append(((PoMgr) mvcMgr).getCurrentPurchaseOrder().getVendor().getVendorId()); sqlBuffer.append(" ) PVP "); sqlBuffer.append(" WHERE IP.ORDERABLE_FLAG = 'Y' "); sqlBuffer.append(" AND NVL(IP.TEMPLATE_ITEM_FLAG,'N') = 'N' "); sqlBuffer.append(" AND IPT.PART_TYPE_ID = IP.PART_TYPE_ID "); sqlBuffer.append(" AND IU.UOM_ID = IP.UOM_ID "); if (((PoMgr) mvcMgr).getCurrentPurchaseOrder().getVendor().isMajorSupplier()) sqlBuffer.append(" AND PVP.PART_ID(+) = IP.PART_ID "); else sqlBuffer.append(" AND PVP.PART_ID = IP.PART_ID "); if (ParameterUtil.isItemSeparatedByFactory) { sqlBuffer.append( " AND EXISTS (SELECT 'O' FROM ITEM_PART_FACTORY IPF WHERE IPF.PART_ID = IP.PART_ID AND IPF.FACTORY_ID = " + login.getEmployee().getFactoryId() + " ) "); } this.isRearchCondition(sqlBuffer); if (!this.isHaveOrderBy(sqlBuffer)) { sqlBuffer.append(" ORDER BY 2 "); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_PO)) { sqlBuffer.append(" SELECT DISTINCT PP.PO_ID, PV.VENDOR_ID, PP.CONTACT_ID, "); sqlBuffer.append(" PP.BILL_TO_SITE_ID, PP.SHIP_TO_SITE_ID, PP.CURRENCY_CODE, "); sqlBuffer.append(" PP.CURRENCY_RATE, PP.ITEM_TOTAL_AMOUNT, PP.DELIVERY_TERM_ID, "); sqlBuffer.append( " TO_CHAR(PP.DELIVERY_DATE,'DD-MM-YYYY') , PP.REMARK, PP.SHIPPING_MARK, "); sqlBuffer.append( " PP.STATUS, TO_CHAR(PP.CREATION_DATE, 'YYYY-MM-DD'), PP.CREATED_BY, "); sqlBuffer.append( " TO_CHAR(PP.MODIFIED_DATE, 'DD-MM-YYYY'), PP.MODIFIED_REASON, PP.MODIFIED_BY, "); sqlBuffer.append(" PV.VENDOR_NAME, PC.CONTACT_PERSON_NAME, PVF.F_ADDRESS, "); sqlBuffer.append(" PVF.F_TEL1, PVF.F_FAX1, PC.E_MAIL, "); sqlBuffer.append(" PP.PO_TYPE, PP.PART_CATEGORY , PP.PO_REF_NO, "); sqlBuffer.append(" PV.VENDOR_CODE ,PP.PO_VAT ,NVL(PP.PO_DISCOUNT,0), "); sqlBuffer.append(" NVL(PP.PO_REVISION,1) , NVL(PV.MAJOR_SUPPLIER_FLAG,'N') "); sqlBuffer.append(" FROM PUR_CONTACT PC, "); sqlBuffer.append(" PUR_VENDOR PV, "); sqlBuffer.append(" PUR_PO PP, "); sqlBuffer.append(" PUR_VENDOR_FACTORY PVF "); sqlBuffer.append(" WHERE PV.VENDOR_ID = PP.VENDOR_ID "); sqlBuffer.append(" AND PC.VENDOR_ID = PP.VENDOR_ID "); sqlBuffer.append(" AND PC.CONTACT_ID(+) = PP.CONTACT_ID "); sqlBuffer.append(" AND PVF.FACTORY_ID(+) = PC.FACTORY_ID "); if (mvcMgr.getEntryMode().equals(Constant.VIEW_STATUS)) { sqlBuffer.append(" AND PP.STATUS IN ('C','D','S','M') "); } else if (mvcMgr.getEntryMode().equals(Constant.APPROVE_QUICK_PO)) { if (login.getEmployee().getUserRightLevel() != null && !login.getEmployee().getUserRightLevel().equals("")) { sqlBuffer.append( " AND NVL(PP.PO_TOTAL_AMOUNT,0) <= (SELECT DECODE(PPAR.DISABLE_FLAG, 'N', NVL(MAX_APPROVAL_AMOUNT, 999999999), 999999999) FROM PUR_PO_APPROVAL_RIGHT PPAR, GM_CURRENCY GC WHERE PPAR.CURRENCY_ID(+) = GC.CURRENCY_ID AND GC.CURRENCY_ID = PP.CURRENCY_ID AND PPAR.USER_RIGHT_LEVEL(+) = " + login.getEmployee().getUserRightLevel() + ") "); } sqlBuffer.append(" AND PP.STATUS IN ('P','V') "); sqlBuffer.append(" AND PP.QUICK_PO_STATUS IN ('Y') "); } else if (mvcMgr.getEntryMode().equals(Constant.REVISE_QUICK_PO)) { sqlBuffer.append(" AND PP.STATUS IN ('C','R') "); sqlBuffer.append(" AND PP.QUICK_PO_STATUS IN ('Y') "); } else if (mvcMgr.getEntryMode().equals(Constant.REVISE_QUICK_PO_INFO)) { sqlBuffer.append(" AND PP.STATUS NOT IN ('D') "); sqlBuffer.append(" AND PP.QUICK_PO_STATUS IN ('Y') "); } else if (mvcMgr.getEntryMode().equals(Constant.SEND_OUT_QUICK_PO)) { sqlBuffer.append(" AND PP.STATUS IN ('A') "); sqlBuffer.append(" AND PP.QUICK_PO_STATUS IN ('Y') "); } else if (mvcMgr.getEntryMode().equals(Constant.DELETE_QUICK_PO)) { sqlBuffer.append(" AND PP.STATUS IN ('C','R') "); sqlBuffer.append(" AND PP.QUICK_PO_STATUS IN ('Y') "); } else if (mvcMgr.getEntryMode().equals(Constant.CLOSE_QUICK_PO)) { sqlBuffer.append(" AND PP.STATUS IN ('S') "); sqlBuffer.append(" AND PP.QUICK_PO_STATUS IN ('Y') "); } else if (mvcMgr.getEntryMode().equals(Constant.MODIFY_QUICK_PO)) { sqlBuffer.append(" AND PP.STATUS IN ('S') "); sqlBuffer.append(" AND PP.QUICK_PO_STATUS IN ('Y') "); } else { sqlBuffer.append(" AND PP.STATUS = 'C' "); } this.isRearchCondition(sqlBuffer); if (!this.isHaveOrderBy(sqlBuffer)) { sqlBuffer.append(" ORDER BY PO_ID DESC "); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_PO_COPY)) { sqlBuffer.append(" SELECT DISTINCT PP.PO_ID, PV.VENDOR_ID, PP.CONTACT_ID, "); sqlBuffer.append(" PP.BILL_TO_SITE_ID, PP.SHIP_TO_SITE_ID, PP.CURRENCY_CODE, "); sqlBuffer.append(" PP.CURRENCY_RATE, PP.ITEM_TOTAL_AMOUNT, PP.DELIVERY_TERM_ID, "); sqlBuffer.append( " TO_CHAR(PP.DELIVERY_DATE,'DD-MM-YYYY') , PP.REMARK, PP.SHIPPING_MARK, "); sqlBuffer.append( " PP.STATUS, TO_CHAR(PP.CREATION_DATE, 'YYYY-MM-DD'), PP.CREATED_BY, "); sqlBuffer.append( " TO_CHAR(PP.MODIFIED_DATE, 'DD-MM-YYYY'), PP.MODIFIED_REASON, PP.MODIFIED_BY, "); sqlBuffer.append(" PV.VENDOR_NAME, PC.CONTACT_PERSON_NAME, PVF.F_ADDRESS, "); sqlBuffer.append(" PVF.F_TEL1, PVF.F_FAX1, PC.E_MAIL, "); sqlBuffer.append(" PP.PO_TYPE, PP.PART_CATEGORY , PP.PO_REF_NO, "); sqlBuffer.append(" PV.VENDOR_CODE ,PP.PO_VAT ,NVL(PP.PO_DISCOUNT,0), "); sqlBuffer.append(" NVL(PP.PO_REVISION,1),NVL(PV.MAJOR_SUPPLIER_FLAG,'N') "); sqlBuffer.append(" FROM PUR_CONTACT PC, "); sqlBuffer.append(" PUR_VENDOR PV, "); sqlBuffer.append(" PUR_PO PP, "); sqlBuffer.append(" PUR_VENDOR_FACTORY PVF "); sqlBuffer.append(" WHERE PV.VENDOR_ID = PP.VENDOR_ID "); sqlBuffer.append( " AND PV.VENDOR_ID = " + ((PoMgr) mvcMgr).getCurrentPurchaseOrder().getVendor().getVendorId()); sqlBuffer.append(" AND PC.VENDOR_ID = PP.VENDOR_ID "); sqlBuffer.append(" AND PC.CONTACT_ID(+) = PP.CONTACT_ID "); sqlBuffer.append(" AND PVF.FACTORY_ID(+) = PC.FACTORY_ID "); this.isRearchCondition(sqlBuffer); if (!this.isHaveOrderBy(sqlBuffer)) { sqlBuffer.append(" ORDER BY PO_ID DESC "); } } DeBug.print(sqlBuffer.toString()); return sqlBuffer.toString(); }
/** populateResignList()* */ public void populateResignList(String resignId, HttpServletRequest request) throws SQLException { this.getResignList().clear(); Connection conn = OracleGate.getConnection(); PreparedStatement pstmt = null; ResultSet rs = null; StringBuffer sql = new StringBuffer(); sql.append(" SELECT HPE.EMPLOYEE_ID, HPE.EMPLOYEE_CODE, HPE.EMPLOYEE_DOMESTIC_NAME, "); sql.append(" HPES.STATUS_ID,HPES.STATUS_CODE,HPES.STATUS_NAME, "); sql.append( " TO_CHAR(HPEE.EXPECT_EXIT_DATE ,'DD-MM-YYYY'),TO_CHAR(HPEE.ACTUAL_EXIT_DATE ,'DD-MM-YYYY'),HPEE.EXIT_ID, "); sql.append(" HPEE.RESUME_REASON"); sql.append(" FROM HR_PSNL_EX_EMPLOYEE HPEE,"); sql.append(" HR_PSNL_EMPLOYEE HPE ,"); sql.append(" HR_PSNL_EMPLOYEE_STATUS HPES "); sql.append(" WHERE HPEE.EXIT_ID = :1 "); sql.append(" AND HPEE.EMPLOYEE_ID = HPE.EMPLOYEE_ID "); sql.append(" AND HPEE.STATUS_ID = HPES.STATUS_ID "); sql.append(" AND HPE.STATUS = HPES.STATUS_ID "); sql.append(" AND EXIT_TYPE = 'S' "); sql.append(" ORDER BY 1 "); try { DeBug.print(sql.toString()); pstmt = conn.prepareStatement(sql.toString()); pstmt.setString(1, Decoder.convertSetString(resignId)); rs = pstmt.executeQuery(); while (rs.next()) { Resign resign = new Resign(); resign.setAttributeId(Decoder.convertGetString(rs.getString(9))); resign.setExpectResignDate(Decoder.convertGetString(rs.getString(7))); resign.setActualResignDate(Decoder.convertGetString(rs.getString(8))); resign.setDescription(Decoder.convertGetString(rs.getString(10))); ResignEmployee resignEmployee = new ResignEmployee(); resignEmployee.setAttributeId(Decoder.convertGetString(rs.getString(1))); resignEmployee.setAttributeCode(Decoder.convertGetString(rs.getString(2))); resignEmployee.setEmployeeDomesticName(Decoder.convertGetString(rs.getString(3))); resign.setResignEmployee(resignEmployee); EmployeeStatus employeeStatus = new EmployeeStatus(); employeeStatus.setAttributeId(Decoder.convertGetString(rs.getString(3))); employeeStatus.setAttributeCode(Decoder.convertGetString(rs.getString(4))); employeeStatus.setAttributeName(Decoder.convertGetString(rs.getString(5))); resign.setEmployeeStatus(employeeStatus); this.getResignList().add(resign); } } finally { try { OracleGate.freeConnection(conn); pstmt.close(); pstmt = null; rs.close(); rs = null; } catch (Exception e) { } } }
public void doService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { Connection conn = null; String JSP_PATH = "/jsp/fm/bank/"; try { conn = com.cynosure.common.sql.OracleGate.getConnection(); String page = request.getParameter("page"); String actionCode = request.getParameter("actionCode"); DeBug.print("page : " + page + " actionCode : " + actionCode); FinanceMaintainMgr financeMaintainMgr = (FinanceMaintainMgr) request.getSession().getAttribute("financeMaintainMgr"); AttributeCode attributeCode = null; if (financeMaintainMgr != null) attributeCode = financeMaintainMgr.getCurrentAttributeCode(); if (actionCode == null) { } else { if (actionCode.startsWith("view")) { financeMaintainMgr = new FinanceMaintainMgr(); financeMaintainMgr.refreshAttributeCodeList(conn, page); request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr); financeMaintainMgr.setEntryMode("AttributeCode"); getServletContext() .getRequestDispatcher(JSP_PATH + "view" + page + ".jsp") .forward(request, response); } else if (actionCode.equals("init")) { financeMaintainMgr = new FinanceMaintainMgr(); /** New object type * */ if (page.equals("Bank")) { financeMaintainMgr.setEntryMode("AttributeCode"); attributeCode = new com.laconic.fm.bank.component.Bank(); } else if (page.equals("VoucherType")) { financeMaintainMgr.setEntryMode("AttributeCode"); attributeCode = new VoucherType(); } else if (page.equals("NoteType")) { financeMaintainMgr.setEntryMode("AttributeCode"); attributeCode = new NoteType(); /*}else if (page.equals("NoteStatus")){ financeMaintainMgr.setEntryMode("AttributeCode"); attributeCode = new NoteStatus();*/ } else if (page.equals("AccountType")) { financeMaintainMgr.setEntryMode("AttributeCode"); attributeCode = new AccountType(); } // initialize selection financeMaintainMgr.setCurrentAttributeCode(attributeCode); financeMaintainMgr.refreshAttributeCodeList(conn, page); request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr); getServletContext() .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp") .forward(request, response); } else if (actionCode.equals("update")) { // financeMaintainMgr = new FinanceMaintainMgr(); /** New object type * */ if (page.equals("Bank")) { financeMaintainMgr.setEntryMode("UPDATE-BANK"); String bankID = request.getParameter("bankID"); financeMaintainMgr.setCurrentAttributeCode(financeMaintainMgr.getAttributeCode(bankID)); } else if (page.equals("AccountType")) { financeMaintainMgr.setEntryMode("UPDATE-ACCOUNT-TYPE"); String accountTypeID = request.getParameter("accountTypeID"); financeMaintainMgr.setCurrentAttributeCode( financeMaintainMgr.getAttributeCode(accountTypeID)); } else if (page.equals("NoteType")) { financeMaintainMgr.setEntryMode("UPDATE-NOTE-TYPE"); String noteTypeID = request.getParameter("noteTypeID"); financeMaintainMgr.setCurrentAttributeCode( financeMaintainMgr.getAttributeCode(noteTypeID)); } else if (page.equals("VoucherType")) { financeMaintainMgr.setEntryMode("UPDATE-VOUCHER-TYPE"); String voucherTypeID = request.getParameter("voucherTypeID"); financeMaintainMgr.setCurrentAttributeCode( financeMaintainMgr.getAttributeCode(voucherTypeID)); } // initialize selection // financeMaintainMgr.refreshAttributeCodeList(conn, page); // request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr); getServletContext() .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp") .forward(request, response); } else { // set common attributes from user input // attributeCode.setAttributeCode(request.getParameter("attributeCode")); attributeCode.setAttributeName(request.getParameter("attributeName")); attributeCode.setDescription(request.getParameter("description")); // set additional attributes from user input // // if (attributeCode instanceof Port) { // } else if (attributeCode instanceof OBU) { // OBU obu = (OBU) attributeCode; // obu.setAddress(request.getParameter("address")); // } attributeCode.validate(); if (attributeCode.isValid()) { // DeBug.print("*****="+financeMaintainMgr.getEntryMode().equals("UPDATE-BANK")); if (financeMaintainMgr.getEntryMode().equals("UPDATE-BANK")) ((com.laconic.fm.bank.component.Bank) attributeCode).updateBank(conn); else if (financeMaintainMgr.getEntryMode().equals("UPDATE-ACCOUNT-TYPE")) ((AccountType) attributeCode).updateAccountType(conn); else if (financeMaintainMgr.getEntryMode().equals("UPDATE-NOTE-TYPE")) ((NoteType) attributeCode).saveNoteType(); else if (financeMaintainMgr.getEntryMode().equals("UPDATE-VOUCHER-TYPE")) ((VoucherType) attributeCode).saveVoucherType(); else attributeCode.save(); if (attributeCode.hasMessage()) { } else { // save successfully // add saved attribute code to list ((LinkedList) financeMaintainMgr.getAttributeCodeList()).addFirst(attributeCode); // give a new attribute code // if (attributeCode instanceof com.laconic.fm.bank.component.Bank) { attributeCode = new com.laconic.fm.bank.component.Bank(); financeMaintainMgr.setCurrentAttributeCode(attributeCode); financeMaintainMgr.refreshAttributeCodeList(conn, page); financeMaintainMgr.setEntryMode("AttributeCode"); request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr); } else if (attributeCode instanceof AccountType) { attributeCode = new AccountType(); financeMaintainMgr.setCurrentAttributeCode(attributeCode); financeMaintainMgr.refreshAttributeCodeList(conn, page); financeMaintainMgr.setEntryMode("AttributeCode"); request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr); } else if (attributeCode instanceof VoucherType) { attributeCode = new VoucherType(); financeMaintainMgr.setCurrentAttributeCode(attributeCode); financeMaintainMgr.refreshAttributeCodeList(conn, page); financeMaintainMgr.setEntryMode("AttributeCode"); request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr); } else if (attributeCode instanceof NoteType) { attributeCode = new NoteType(); financeMaintainMgr.setCurrentAttributeCode(attributeCode); financeMaintainMgr.refreshAttributeCodeList(conn, page); financeMaintainMgr.setEntryMode("AttributeCode"); request.getSession().setAttribute("financeMaintainMgr", financeMaintainMgr); } /*else if (attributeCode instanceof NoteStatus) attributeCode = new NoteStatus(); */ financeMaintainMgr.setCurrentAttributeCode(attributeCode); } } getServletContext() .getRequestDispatcher(JSP_PATH + "add" + page + ".jsp") .forward(request, response); } } } finally { if (conn != null) com.cynosure.common.sql.OracleGate.freeConnection(conn); } }
// refresh Quotation Contact List public void populateQuotationContact( String quotationId, int quotationRevision, QuotationMgr quotationMgr) throws SQLException { this.getContactList().clear(); Connection conn = null; conn = com.cynosure.common.sql.OracleGate.getConnection(); StringBuffer sql = new StringBuffer(); sql.append(" SELECT MC.COUNTRY_CODE, MC.COUNTRY_NAME, MC.DESCRIPTION, "); sql.append(" MCS.SITE_CODE, MCS.SITE_NAME, MCS.ADDRESS,"); sql.append(" MCS.PHONE, MCS.FAX, MCS.MAIN_OFFICE, "); sql.append(" MCC.CONTACT_CODE, MCC.CUSTOMER_CODE, MCC.CONTACT_PERSON, "); sql.append(" MCC.DEP, MCC.TITLE, MCC.EMAIL, "); sql.append(" MCC.PHONE, MCC.EXT, MCC.DECISION_MAKER, "); sql.append(" MCC.DESCRIPTION, MC.COUNTRY_ID, MCS.SITE_ID, "); sql.append(" MCC.CONTACT_ID, NVL(OQQV.PAYMENT_TERM_ID, '0') "); sql.append(" FROM MOD_CUST_CONTACT MCC, "); sql.append(" MOD_CUST_SITE MCS, "); sql.append(" MOD_COUNTRY MC, "); sql.append(" OM_QUOTE_QUOTE_REV OQQV "); sql.append(" WHERE OQQV.QUOTATION_ID = :1 "); sql.append(" AND OQQV.QUOTATION_REV = :2 "); sql.append(" AND MCC.CUSTOMER_ID = OQQV.CUSTOMER_ID "); sql.append(" AND MCC.CONTACT_ID = OQQV.CONTACT_ID "); sql.append(" AND MCS.CUSTOMER_ID = MCC.CUSTOMER_ID "); sql.append(" AND MCS.SITE_ID = MCC.SITE_ID "); sql.append(" AND MC.COUNTRY_ID = MCS.COUNTRY_ID "); DeBug.print(sql.toString()); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = conn.prepareStatement(sql.toString()); pstmt.setString(1, Decoder.convertSetString(quotationId)); pstmt.setInt(2, quotationRevision); rs = pstmt.executeQuery(); if (rs.next()) { Country country = new Country(); country.setAttributeId(Decoder.convertGetString(String.valueOf(rs.getLong(20)))); country.setAttributeCode(Decoder.convertGetString(rs.getString(1))); country.setAttributeName(Decoder.convertGetString(rs.getString(2))); country.setDescription(Decoder.convertGetString(rs.getString(3))); Site site = new Site(); site.setSiteId(Decoder.convertGetString(String.valueOf(rs.getLong(21)))); site.setSiteCode(Decoder.convertGetString(rs.getString(4))); site.setSiteName(Decoder.convertGetString(rs.getString(5))); site.setAddress(Decoder.convertGetString(rs.getString(6))); site.setPhone(Decoder.convertGetString(rs.getString(7))); site.setFax(Decoder.convertGetString(rs.getString(8))); site.setSelectedSiteType(Decoder.convertGetString(rs.getString(9))); site.setCountry(country); Contact contact = new Contact(); contact.setContactId(Decoder.convertGetString(String.valueOf(rs.getLong(22)))); contact.setContactCode(Decoder.convertGetString(rs.getString(10))); contact.setContactPersonName(Decoder.convertGetString(rs.getString(12))); contact.setDepartment(Decoder.convertGetString(rs.getString(13))); contact.setTitle(Decoder.convertGetString(rs.getString(14))); contact.setPhone(Decoder.convertGetString(rs.getString(16))); contact.setExt(Decoder.convertGetString(rs.getString(17))); contact.setEmail(Decoder.convertGetString(rs.getString(15))); contact.setIsDecisionMaker( Decoder.convertGetString(rs.getString(18)) != null && Decoder.convertGetString(rs.getString(18)).equals("Y") ? true : false); contact.setDescription(Decoder.convertGetString(rs.getString(19))); if (rs.getString(23) != null && !rs.getString(23).equals("")) { this.setPaymentTerm( (SelectionOption) Utility.getObject( quotationMgr.getCurrentQoutationFormMeta().getPaymentTermList(), rs.getString(23))); } contact.setSite(site); this.setCurrentContact(contact); } } finally { if (conn != null) { OracleGate.freeConnection(conn); } try { if (pstmt != null) { pstmt.close(); } pstmt = null; rs.close(); rs = null; } catch (Exception e) { e.printStackTrace(); } } }
public void save(MaintainingSetupMgr maintainingSetupMgr, Login login) throws SQLException { this.mCode = 0; CallableStatement cstmt = null; Connection conn = OracleGate.getConnection(); conn.setAutoCommit(false); try { cstmt = conn.prepareCall("begin MM_DATAMAINTAIN_PKG.MODIFY_TYPE(:1,:2,:3,:4,:5,:6,:7,:8); end;"); cstmt.setString(1, Decoder.convertSetString(this.getAttributeCode())); cstmt.setString(2, Decoder.convertSetString(this.getAttributeName())); cstmt.setString(3, Decoder.convertSetString(this.getDescription())); cstmt.setString( 6, Decoder.convertSetString(maintainingSetupMgr.getFunctionMode().split("-")[0])); cstmt.setString(7, Decoder.convertSetString(login.getEmployee().getEmployeeId())); if (this.getAttributeId() != null && !this.getAttributeId().equals("")) { cstmt.setString(8, Decoder.convertSetString(this.getAttributeId())); } else { cstmt.setNull(8, Types.VARCHAR); } cstmt.registerOutParameter(4, Types.INTEGER); cstmt.registerOutParameter(5, Types.VARCHAR); cstmt.registerOutParameter(8, Types.VARCHAR); DeBug.print("Start Save MechanicalType DeBug.Print: "); DeBug.print("1,this.getAttributeCode(): " + this.getAttributeCode()); DeBug.print("2,this.getAttributeName(): " + this.getAttributeName()); DeBug.print("3,this.getDescription(): " + this.getDescription()); DeBug.print( "6,maintainingSetupMgr.getFunctionMode().split(-)[0]: " + maintainingSetupMgr.getFunctionMode().split("-")[0]); DeBug.print("7,login.getEmployee().getEmployeeId(): " + login.getEmployee().getEmployeeId()); DeBug.print("8,this.getAttributeId(): " + this.getAttributeId()); DeBug.print("-----------END-----------"); cstmt.execute(); int returnCode = cstmt.getInt(4); String returnMessage = cstmt.getString(5); DeBug.print(String.valueOf(returnCode), "(4,in Save : the returnCode )"); DeBug.print(returnMessage, "(5,in Save : the returnMessage )"); if (returnCode == -2) { // Violate unique constraint in database conn.rollback(); this.mCode = UNIQUE_VIOLATION; } else if (returnCode != 0) { // Non-manageable error. conn.rollback(); this.mCode = SAVE_ERROR; } else { conn.commit(); this.setAttributeId(String.valueOf(cstmt.getLong(8))); this.isSaved = true; } } catch (Exception e) { conn.rollback(); this.isSaved = false; e.printStackTrace(); this.mCode = SAVE_ERROR; } finally { conn.setAutoCommit(true); if (conn != null) { OracleGate.freeConnection(conn); } try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
/** saveResign()* */ public void saveResign(ResignMgr resignMgr, HttpServletRequest request) throws SQLException { this.mCode = 0; CallableStatement cstmt = null; Connection conn = null; conn = OracleGate.getConnection(); conn.setAutoCommit(false); try { // this.mCode = 0; String sql = "begin HR_RESIGN_PKG.SAVE_RESIGN(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13); end;"; cstmt = conn.prepareCall(sql); DeBug.print(sql); if (this.getAttributeId() == null) { cstmt.setNull(1, Types.VARCHAR); } else { cstmt.setString(1, Decoder.convertSetString(this.getAttributeId())); } cstmt.setString(2, Decoder.convertSetString(this.getResignEmployee().getAttributeId())); cstmt.setString(3, Decoder.convertSetString(this.getEmployeeStatus().getAttributeId())); cstmt.setString(4, Decoder.convertSetString(this.getDescription())); cstmt.setString(5, Decoder.convertSetString(this.getExpectResignDate())); cstmt.setString(6, Decoder.convertSetString(this.getActualResignDate())); cstmt.setString(7, Decoder.convertSetString(this.getSpecialLeaveDays())); cstmt.setString(8, Decoder.convertSetString(this.getSpecialLeaveHours())); cstmt.setString(9, Decoder.convertSetString(this.getDayOrHour())); cstmt.setString( 10, Decoder.convertSetString( this.getCurrentResignSalaryItem().getCurrentSalaryItem().getAttributeId())); cstmt.setString(11, Decoder.convertSetString(resignMgr.getEntryMode())); cstmt.registerOutParameter(1, Types.VARCHAR); cstmt.registerOutParameter(12, Types.INTEGER); cstmt.registerOutParameter(13, Types.VARCHAR); cstmt.execute(); int returnCode = cstmt.getInt(12); String returnMessage = cstmt.getString(13); DeBug.print("in Save : the returnCode : " + returnCode); DeBug.print("in Save : the returnMessage : " + returnMessage); if (returnCode == -2) { // Violate unique constraint in database conn.rollback(); this.mCode = UNIQUE_VIOLATION; } else if (returnCode != 0) { // Non-manageable error. conn.rollback(); this.mCode = SAVE_ERROR; } else { this.setAttributeId(cstmt.getString(1)); conn.commit(); this.isSaved = true; } } catch (Exception e) { conn.rollback(); e.printStackTrace(); this.mCode = SAVE_ERROR; } finally { conn.setAutoCommit(true); if (conn != null) { OracleGate.freeConnection(conn); } try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
public void populateReportList(EOReportMgr eoReportMgr) throws SQLException { eoReportMgr.getEoReport().getHistoryList().clear(); PreparedStatement pstmt = null; ResultSet rs = null; StringBuffer sqlBuffer = new StringBuffer(); Connection conn = OracleGate.getConnection(); try { sqlBuffer.append(" SELECT OOOD.EO_DETAIL_ID, IP.PART_CODE, IP.PART_NAME, OOOD.EO_REVISION, "); sqlBuffer.append(" TO_CHAR(OOOD.REPORT_DATE, 'DD-MM-YYYY'), OOOD.EO_ID, IP.PART_ID, "); sqlBuffer.append( " TO_CHAR(OOO.EO_CREATION_DATE, 'DD-MM-YYYY'),OOO.EO_ID,OOOD.CUSTOMER_PO_NO ,OOOD.QTY"); sqlBuffer.append( " ,OOOD.REPORT_ID, IP.UNIT_WIDTH, IP.UNIT_LENGTH, IP.UNIT_HEIGHT, IP.MODEL_SIZE,IP.BY_PRODUCT_FLAG "); sqlBuffer.append(" FROM OM_OE_ORDER_DETAIL OOOD , "); sqlBuffer.append(" ITEM_PART IP, "); sqlBuffer.append(" OM_OE_ORDER OOO "); sqlBuffer.append(" WHERE OOOD.REPORT_ID = :1 "); sqlBuffer.append(" AND IP.PART_ID = OOOD.PART_ID "); // sqlBuffer.append(" AND OOERD.EO_REVISION = (SELECT MAX(EO_REVISION ) FROM // OM_OE_EO_REV_DETAIL WHERE EO_ID = OOERD.EO_ID) "); sqlBuffer.append(" AND OOO.EO_ID = OOOD.EO_ID "); // sqlBuffer.append(" AND OOERD.EO_REVISION = OOER.EO_REVISION "); sqlBuffer.append(" AND OOOD.REPORT_ID IS NOT NULL "); sqlBuffer.append( " ORDER BY NVL(IP.COMBINE_FLAG,'N'),OOOD.REQUIRED_DATE,OOOD.CUSTOMER_PO_NO "); pstmt = conn.prepareStatement(sqlBuffer.toString()); pstmt.setString(1, this.getReportId()); rs = pstmt.executeQuery(); DeBug.print(" REPORT_ID : " + this.getReportId()); DeBug.print(sqlBuffer); while (rs.next()) { ExpectOrderDetailReport expectOrderDetail = new ExpectOrderDetailReport(); expectOrderDetail.setEoDetailId(Decoder.convertGetString(rs.getString(1))); expectOrderDetail.setPart(new ItemPart("P")); expectOrderDetail.getPart().setPnId(Decoder.convertGetString(rs.getString(7))); expectOrderDetail.getPart().setPnCode(Decoder.convertGetString(rs.getString(2))); expectOrderDetail.getPart().setPnName(Decoder.convertGetString(rs.getString(3))); expectOrderDetail.setEoId(Decoder.convertGetString(rs.getString(6))); // eoReportMgr.getEoReport().setSystemDate(Decoder.convertGetString(rs.getString(5))); expectOrderDetail.setQty(Decoder.convertGetString(rs.getString(11))); expectOrderDetail.setCreationDate(Decoder.convertGetString(rs.getString(8))); expectOrderDetail.setExpectedOrderId(Decoder.convertGetString(rs.getString(9))); expectOrderDetail.setCustomerPONumber(Decoder.convertGetString(rs.getString(10))); expectOrderDetail.setReportId(Decoder.convertGetString(rs.getString(12))); expectOrderDetail.setUnitWidth(Decoder.convertGetString(rs.getString(13))); expectOrderDetail.setUnitLength(Decoder.convertGetString(rs.getString(14))); expectOrderDetail.setUnitHeight(Decoder.convertGetString(rs.getString(15))); expectOrderDetail.setModelSize(Decoder.convertGetString(rs.getString(16))); expectOrderDetail.setIsByProduct(rs.getString(17) != null && rs.getString(17).equals("Y")); // expectOrderDetail.setIsByProduct(Decoder.convertGetString(rs.getString(17))); eoReportMgr.getEoReport().getHistoryList().add(expectOrderDetail); } } finally { try { OracleGate.freeConnection(conn); pstmt.close(); pstmt = null; rs.close(); rs = null; } catch (Exception e) { } } }