Exemplo n.º 1
0
 @Override
 protected void addDetails() {
   logger.info(
       "Company ID : "
           + companyid
           + " | User Name : "
           + username
           + " > "
           + "Adding new record...");
   // remove the components in the search layout and input controls in the same container
   hlUserInputLayout.removeAllComponents();
   hlUserIPContainer.addComponent(GERPPanelGenerator.createPanel(hlUserInputLayout));
   assembleInputUserLayout();
   // reset the input controls to default value
   tblMstScrSrchRslt.setVisible(false);
   hlCmdBtnLayout.setVisible(false);
   btnaddSpec.setCaption("Add");
   tblSmsEnqDtl.setVisible(true);
   cbBranch.setRequired(true);
   lsVendorName.setRequired(true);
   tfEnqNo.setReadOnly(true);
   lsProduct.setRequired(true);
   lsProduct.setComponentError(null);
   dfEnqDate.setComponentError(null);
   cbUom.setRequired(true);
   loadPurDtl();
   resetFields();
   tfEnqNo.setReadOnly(true);
   try {
     tfEnqNo.setReadOnly(false);
     SlnoGenDM slnoObj =
         serviceSlnogen.getSequenceNumber(companyid, branchId, moduleId, "SM_ENQRYNO ").get(0);
     if (slnoObj.getAutoGenYN().equals("Y")) {
       tfEnqNo.setValue(slnoObj.getKeyDesc());
       tfEnqNo.setReadOnly(true);
     } else {
       tfEnqNo.setReadOnly(false);
     }
   } catch (Exception e) {
     logger.info(e.getMessage());
   }
   comments =
       new SmsComments(
           vlTableForm,
           null,
           companyid,
           null,
           null,
           null,
           null,
           null,
           null,
           null,
           null,
           null,
           null,
           null);
 }
Exemplo n.º 2
0
 @Override
 protected void saveDetails() throws SaveException, FileNotFoundException, IOException {
   logger.info(
       "Company ID : " + companyid + " | User Name : " + username + " > " + "Saving Data... ");
   try {
     SmsPurEnqHdrDM purEnqobj = new SmsPurEnqHdrDM();
     if (tblMstScrSrchRslt.getValue() != null) {
       purEnqobj = beanPurEnqHdrDM.getItem(tblMstScrSrchRslt.getValue()).getBean();
       purEnqobj.setEnquiryNo(tfEnqNo.getValue());
     }
     purEnqobj.setEnquiryNo(tfEnqNo.getValue());
     purEnqobj.setCompanyId(companyid);
     purEnqobj.setEnqRemark(taEnqRem.getValue().toString());
     purEnqobj.setBranchId((Long) cbBranch.getValue());
     purEnqobj.setDueDate((Date) dfDueDate.getValue());
     purEnqobj.setEnquiryDate((Date) dfEnqDate.getValue());
     purEnqobj.setEnquiryStatus(((String) cbEnqStatus.getValue()));
     purEnqobj.setPreparedBy(employeeId);
     purEnqobj.setReviewedBy(null);
     purEnqobj.setActionedBy(null);
     purEnqobj.setLastUpdateddt(DateUtils.getcurrentdate());
     purEnqobj.setLastUpdatedby(username);
     serviceSmsPurEnqHdr.saveorUpdateSmsPurEnqHdrDetails(purEnqobj);
     enquiryId = purEnqobj.getEnquiryId();
     String[] split =
         lsVendorName.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(",");
     for (String obj : split) {
       if (obj.trim().length() > 0) {
         EnquiryVendorDtlDM enqvendtl = new EnquiryVendorDtlDM();
         enqvendtl.setEnqid(purEnqobj.getEnquiryId());
         System.out.println("vendid" + Long.valueOf(obj.trim()));
         enqvendtl.setVendorid(Long.valueOf(obj.trim()));
         serviceEnquiryVendorDtl.save(enqvendtl);
       }
     }
     @SuppressWarnings("unchecked")
     Collection<SmsPurEnqDtlDM> itemIds =
         (Collection<SmsPurEnqDtlDM>) tblSmsEnqDtl.getVisibleItemIds();
     for (SmsPurEnqDtlDM save : (Collection<SmsPurEnqDtlDM>) itemIds) {
       save.setEnquiryId(Long.valueOf(purEnqobj.getEnquiryId().toString()));
       serviceSmsPurEnqDtl.saveorUpdateSmsPurEnqDtlDetails(save);
     }
     comments.resetfields();
     if (tblMstScrSrchRslt.getValue() == null) {
       try {
         SlnoGenDM slnoObj =
             serviceSlnogen.getSequenceNumber(companyid, branchId, moduleId, "SM_ENQRYNO").get(0);
         if (slnoObj.getAutoGenYN().equals("Y")) {
           serviceSlnogen.updateNextSequenceNumber(companyid, branchId, moduleId, "SM_ENQRYNO");
         }
       } catch (Exception e) {
       }
     }
     tfEnqNo.setReadOnly(false);
     tfEnqNo.setValue(purEnqobj.getEnquiryNo());
     tfEnqNo.setReadOnly(true);
     comments.saveEnquiry(purEnqobj.getEnquiryId(), purEnqobj.getEnquiryStatus());
     loadSrchRslt();
     enqDtlresetFields();
   } catch (Exception e) {
     logger.info(e.getMessage());
   }
 }