protected void processEditModel( String actionCode, String actionObject, HttpServletRequest request) throws SQLException { WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request); workCenterMgr.setFunctionMode(Constant.UPDATE); String key = actionCode.split("-")[2]; if (actionObject.equals("WorkCenter")) { WorkCenter workCenter = (WorkCenter) Utility.getObject(workCenterMgr.getCurrentWorkCenterMeta().getWorkCenterList(), key); workCenterMgr.setCurrentWorkCenter(workCenter); } else if (actionObject.equals("WorkerGroup")) { WorkerGroup workerGroup = (WorkerGroup) Utility.getObject( workCenterMgr.getCurrentWorkerGroupMeta().getWorkerGroupList(), key); workCenterMgr.setCurrentWorkerGroup(workerGroup); } else if (actionObject.equals("Worker")) { Worker worker = (Worker) Utility.getObject(workCenterMgr.getCurrentWorkerGroupMeta().getWorkerList(), key); workCenterMgr.setCurrentWorker(worker); workCenterMgr .getCurrentWorkerGroupMeta() .refreshDepartment(worker.getEmployee().getEmployeeId()); worker.setDepartment( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkerGroupMeta().getDepartmentList(), worker.getDepartment().getAttributeId())); } }
protected void processSelectModel( String actionCode, String actionObject, HttpServletRequest request) throws SQLException { WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request); String serial = actionCode.split("-")[2]; if (actionObject.equals("Employee")) { Employee employee = (Employee) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); if (workCenterMgr.getEntryMode().equals(Constant.WORKER_GROUP)) { workCenterMgr.getCurrentWorkerGroup().setLeader(employee); } else if (workCenterMgr.getEntryMode().equals(Constant.CREATE_WORKER)) { workCenterMgr.getCurrentWorker().setEmployee(employee); workCenterMgr.getCurrentWorkerGroupMeta().refreshDepartment(employee.getEmployeeId()); } } else if (actionObject.equals("WorkerGroup")) { WorkerGroup workerGroup = (WorkerGroup) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); workCenterMgr.getCurrentWorker().setWorkerGroup(workerGroup); } else if (actionObject.equals("Worker")) { Worker worker = (Worker) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); workCenterMgr.getCurrentWorking().setWorker(worker); workCenterMgr.getCurrentWorking().getWorkingDetailList().clear(); } else if (actionObject.equals("Assignment")) { WorkingAssignment workingAssignment = (WorkingAssignment) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); if (workingAssignment != null && !workCenterMgr.getCurrentWorking().isSelected(serial)) { WorkingDetail workingDetail = new WorkingDetail(); workingDetail.setWorkingAssignment(workingAssignment); workingDetail.setSheetQty(workingAssignment.getAssignmentQty()); workCenterMgr.getCurrentWorking().getWorkingDetailList().add(workingDetail); workCenterMgr.getCurrentWorking().setDetailListRowNo(); } } else if (actionObject.equals("Working")) { Working working = (Working) Utility.getObject( workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial); workCenterMgr.setCurrentWorking(working); workCenterMgr.getCurrentWorking().populateWorkingDetailList(); WorkingDetail workingDetail = (WorkingDetail) ((LinkedList) workCenterMgr.getCurrentWorking().getWorkingDetailList()).getFirst(); workCenterMgr .getCurrentWorking() .populateWorker(workCenterMgr, workingDetail.getWorkingAssignment().getWorkerId()); } }
private void setHttpRequestStockPlace(HttpServletRequest request, OutMgr outMgr) { outMgr.setCurrentInventoryPlace(request.getParameter("place")); outMgr.setLocationPlace( (LocationPlace) Utility.getObject( outMgr.getStockPlaceMeta().getStockPlaceList(), request.getParameter("place"))); }
private void setHttpRequestWorkCenter(HttpServletRequest request, WorkCenterMgr workCenterMgr) { WorkCenter workCenter = workCenterMgr.getCurrentWorkCenter(); workCenter.setWorkCenterCode(request.getParameter("workCenterCode")); workCenter.setWorkCenterName(request.getParameter("workCenterName")); workCenter.setWorkCenterDescription(request.getParameter("workCenterDescription")); workCenter.setFactoryLocation( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkCenterMeta().getFindFactoryList(), request.getParameter("factoryList"))); }
private void setHttpParameterWorker(HttpServletRequest request, WorkCenterMgr workCenterMgr) { Worker worker = workCenterMgr.getCurrentWorker(); worker.setWorkerNo(request.getParameter("workerNo")); if (request.getParameter("isDisable") != null && request.getParameter("isDisable").equals("Y")) { worker.setDisable(true); } else { worker.setDisable(false); } worker.setDepartment( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkerGroupMeta().getDepartmentList(), request.getParameter("departmentList"))); }
private void setHttpParameterWorkerGroup( HttpServletRequest request, WorkCenterMgr workCenterMgr) { WorkerGroup workerGroup = workCenterMgr.getCurrentWorkerGroup(); workerGroup.setWorkerGroupCode(request.getParameter("workerGroupCode")); workerGroup.setWorkerGroupName(request.getParameter("workerGroupName")); workerGroup.setWorkerGroupDescription(request.getParameter("description")); workerGroup.setFactoryLocation( (SelectionOption) Utility.getObject( workCenterMgr.getCurrentWorkCenterMeta().getFindFactoryList(), request.getParameter("factoryList"))); if (request.getParameter("isDisable") != null && request.getParameter("isDisable").equals("Y")) { workerGroup.setIsDisable(true); } else { workerGroup.setIsDisable(false); } }
protected void processDeleteModel( String actionCode, String actionObject, HttpServletRequest request) throws SQLException { WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request); if (actionObject.equals("Assignment")) { String key = actionCode.split("-")[2]; this.setHttpParameterWorking(request, workCenterMgr); WorkingDetail workingDetail = (WorkingDetail) Utility.getObject(workCenterMgr.getCurrentWorking().getWorkingDetailList(), key); workCenterMgr.getCurrentWorking().getWorkingDetailList().remove(workingDetail); workCenterMgr.getCurrentWorking().setDetailListRowNo(); } else if (actionObject.equals("Working")) { workCenterMgr.setFunctionMode(Constant.DELETE); workCenterMgr .getCurrentWorking() .saveStatus(workCenterMgr.getFunctionMode(), this.getLogin(request)); } }
public void populateResultSet(MVCMgr mvcMgr, ResultSet rs) throws Exception { if (rs != null) { if (mvcMgr.getFoundMode().equals(Constant.FIND_VENDOR)) { while (rs.next()) { PoVendor vendor = new PoVendor(); vendor.setVendorId(Decoder.convertGetString(rs.getString(26))); vendor.setVendorCode(Decoder.convertGetString(rs.getString(1))); vendor.setVendorName(Decoder.convertGetString(rs.getString(2))); vendor.setAddress(Decoder.convertGetString(rs.getString(3))); vendor.setPresident(Decoder.convertGetString(rs.getString(4))); vendor.setWebsite(Decoder.convertGetString(rs.getString(5))); vendor.setCreditLine(Decoder.convertGetString(rs.getString(14))); vendor.setTurnover(Decoder.convertGetString(rs.getString(15))); vendor.setEmployeeNum(Decoder.convertGetString(rs.getString(16))); vendor.setEstablishedYear(Decoder.convertGetString(rs.getString(17))); vendor.setMajorMarket(Decoder.convertGetString(rs.getString(18))); vendor.setImportPercentage(Decoder.convertGetString(rs.getString(19))); vendor.setExportPercentage(Decoder.convertGetString(rs.getString(20))); vendor.setGroupCompany(Decoder.convertGetString(rs.getString(21))); vendor.setTotalCapacity(Decoder.convertGetString(rs.getString(22))); vendor.setConclusion(Decoder.convertGetString(rs.getString(23))); vendor.setPaymentTerm( (PaymentTerm) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getPaymentTermList(), Decoder.convertGetString(rs.getString(27)))); vendor.setVat( (VAT) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getVatList(), Decoder.convertGetString(rs.getString(28)))); vendor.setPoType( (SelectionOption) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getPoTypeList(), Decoder.convertGetString(rs.getString(29)))); vendor.setDeliveryTerm( (DeliveryTerm) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getDeliveryTermList(), rs.getString(30))); vendor.setMajorSupplier(rs.getString(31) != null && rs.getString(31).equals("Y")); this.getFindList().add(vendor); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_CONTACT)) { while (rs.next()) { PoVendorContact contact = new PoVendorContact(); contact.setContactId(Decoder.convertGetString(rs.getString(1))); contact.setContactCode(Decoder.convertGetString(rs.getString(2))); contact.setContactPersonName(Decoder.convertGetString(rs.getString(3))); contact.setMobile(Decoder.convertGetString(rs.getString(4))); contact.setEmail(Decoder.convertGetString(rs.getString(5))); contact.setFactoryCode(Decoder.convertGetString(rs.getString(7))); contact.setAddress(Decoder.convertGetString(rs.getString(8))); contact.setMobile(Decoder.convertGetString(rs.getString(9))); contact.setFax(Decoder.convertGetString(rs.getString(10))); contact.setPoType( (SelectionOption) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getPoTypeList(), Decoder.convertGetString(rs.getString(11)))); this.getFindList().add(contact); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_PO_PART)) { while (rs.next()) { PoPurchaseRequestDetail purchaseRequestDetail = new PoPurchaseRequestDetail(); purchaseRequestDetail.setPrDetailId(rs.getString(1)); purchaseRequestDetail.setPrId(Decoder.convertGetString(rs.getString(2))); purchaseRequestDetail.setPrNo(Decoder.convertGetString(rs.getString(2))); purchaseRequestDetail.setRequestQty(Decoder.convertGetString(rs.getString(3))); purchaseRequestDetail.setRequestDate(Decoder.convertGetString(rs.getString(4))); purchaseRequestDetail.setRemark(Decoder.convertGetString(rs.getString(5))); purchaseRequestDetail.setCreatedBy(Decoder.convertGetString(rs.getString(18))); purchaseRequestDetail.setPartTypeCode(Decoder.convertGetString(rs.getString(19))); purchaseRequestDetail.setVpnCode(Decoder.convertGetString(rs.getString(20))); purchaseRequestDetail.setVpnName(Decoder.convertGetString(rs.getString(21))); Quote quote = new Quote(); quote.setQuoteUnitPrice(Decoder.convertGetString(rs.getString(16))); Currency currency = new Currency(); currency.setAttributeId(Decoder.convertGetString(rs.getString(17))); currency.setAttributeCode(Decoder.convertGetString(rs.getString(17))); currency.setAttributeName(Decoder.convertGetString(rs.getString(17))); quote.setCurrency(currency); purchaseRequestDetail.setQuote(quote); PoPart part = new PoPart(Decoder.convertGetString(rs.getString(12))); part.setPnId(Decoder.convertGetString(rs.getString(7))); part.setPnCode(Decoder.convertGetString(rs.getString(8))); part.setPnName(Decoder.convertGetString(rs.getString(9))); part.setPartFullName(Decoder.convertGetString(rs.getString(10))); part.setPrimaryUnitOfMeasure( new UOM( Decoder.convertGetString(rs.getString(13)), Decoder.convertGetString(rs.getString(14)), Decoder.convertGetString(rs.getString(15)))); PartType partType = new PartType(); partType.setAttributeId(Decoder.convertGetString(rs.getString(19))); partType.setAttributeCode(Decoder.convertGetString(rs.getString(22))); partType.setAttributeName(Decoder.convertGetString(rs.getString(23))); part.setPartType(partType); purchaseRequestDetail.setPart(part); this.getFindList().add(purchaseRequestDetail); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_PART) || mvcMgr.getFoundMode().equals(Constant.FIND_FOC_PART)) { while (rs.next()) { PoPart part = new PoPart(Decoder.convertGetString(rs.getString(7))); part.setPnId(Decoder.convertGetString(rs.getString(1))); part.setPnCode(Decoder.convertGetString(rs.getString(2))); part.setPartName(Decoder.convertGetString(rs.getString(3))); part.setPartFullName(Decoder.convertGetString(rs.getString(4))); part.setCompleteName(Decoder.convertGetString(rs.getString(5))); part.setPnDescription(Decoder.convertGetString(rs.getString(6))); part.setStdPurchaseUnitPrice(Decoder.convertGetString(rs.getString(8))); part.setPurchaseLeadTime(Decoder.convertGetString(rs.getString(9))); UOM uom = new UOM(); uom.setAttributeId(Decoder.convertGetString(rs.getString(10))); uom.setAttributeCode(Decoder.convertGetString(rs.getString(11))); uom.setAttributeName(Decoder.convertGetString(rs.getString(12))); part.setPrimaryUnitOfMeasure(uom); PartType partType = new PartType(); partType.setAttributeId(Decoder.convertGetString(rs.getString(13))); partType.setAttributeCode(Decoder.convertGetString(rs.getString(14))); partType.setAttributeName(Decoder.convertGetString(rs.getString(15))); part.setPartType(partType); part.getLocation().setAttributeId(Decoder.convertGetString(rs.getString(16))); part.setVpnCode(Decoder.convertGetString(rs.getString(17))); part.setVpnName(Decoder.convertGetString(rs.getString(18))); this.getFindList().add(part); } } else if (mvcMgr.getFoundMode().equals(Constant.FIND_PO) || mvcMgr.getFoundMode().equals(Constant.FIND_PO_COPY)) { while (rs.next()) { PurchaseOrder purchaseOrder = new PurchaseOrder(); PoVendorContact contact = new PoVendorContact(); PoVendor vendor = new PoVendor(); purchaseOrder.setPoNo(Decoder.convertGetString(rs.getString(1))); vendor.setVendorId(Decoder.convertGetString(rs.getString(2))); contact.setContactId(Decoder.convertGetString(rs.getString(3))); purchaseOrder.setBillToSelfSite( (SelfSite) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getSelfSiteList(), rs.getString(4))); purchaseOrder.setShipToSelfSite( (SelfSite) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getSelfSiteList(), rs.getString(5))); purchaseOrder.setCurrency( (Currency) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getCurrencyList(), rs.getString(6))); purchaseOrder.setPoTotalAmount(rs.getString(8)); purchaseOrder.setDeliveryTerm( (DeliveryTerm) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getDeliveryTermList(), rs.getString(9))); purchaseOrder.setDeliveryDate(Decoder.convertGetString(rs.getString(10))); purchaseOrder.setRemark(Decoder.convertGetString(rs.getString(11))); purchaseOrder.setShippingMark(Decoder.convertGetString(rs.getString(12))); purchaseOrder.setPoStatus( (PoStatus) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getPoStatusList(), rs.getString(13))); purchaseOrder.setCreationDate(Decoder.convertGetString(rs.getString(14))); purchaseOrder.setCreatedBy(Decoder.convertGetString(rs.getString(15))); purchaseOrder.setModifiedReason(Decoder.convertGetString(rs.getString(17))); vendor.setVendorName(Decoder.convertGetString(rs.getString(19))); contact.setContactPersonName(Decoder.convertGetString(rs.getString(20))); contact.setAddress(Decoder.convertGetString(rs.getString(21))); contact.setMobile(Decoder.convertGetString(rs.getString(22))); contact.setFax(Decoder.convertGetString(rs.getString(23))); contact.setEmail(Decoder.convertGetString(rs.getString(24))); purchaseOrder.setPoType( (SelectionOption) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getPoTypeList(), rs.getString(25))); purchaseOrder.setPoCategory( (PoCategory) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getPoCategoryList(), rs.getString(26))); purchaseOrder.setPoRefNo(Decoder.convertGetString(rs.getString(27))); // purchaseOrder.setRevision(rs.getInt(27)); vendor.setVendorCode(rs.getString(28)); purchaseOrder.setVat( (VAT) Utility.getObject( ((PoMgr) mvcMgr).getPurchaseOrderMeta().getVatList(), rs.getString(29))); // // purchaseOrder.setIsSuspense(Decoder.convertGetString(rs.getString(30)).equals("Y") ? // true : false); purchaseOrder.setDiscountTotalPrice(Decoder.convertGetString(rs.getString(30))); purchaseOrder.setRevision(Decoder.convertGetString(rs.getString(31))); vendor.setCurrentPoContact(contact); purchaseOrder.setVendor(vendor); if (((PoMgr) mvcMgr).getEntryMode().equals(Constant.VIEW_STATUS)) { purchaseOrder.setFlag("Y"); } vendor.setMajorSupplier(rs.getString(32) != null && rs.getString(32).equals("Y")); this.getFindList().add(purchaseOrder); } } } }
// 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(); } } }