Exemplo n.º 1
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());
   }
 }
Exemplo n.º 2
0
 // Method to edit the values from table into fields to update process
 private void editPurHdr() {
   logger.info(
       "Company ID : "
           + companyid
           + " | User Name : "
           + username
           + " > "
           + "Editing the selected record");
   try {
     hlUserInputLayout.setVisible(true);
     if (tblMstScrSrchRslt.getValue() != null) {
       SmsPurEnqHdrDM enqHdrDM = beanPurEnqHdrDM.getItem(tblMstScrSrchRslt.getValue()).getBean();
       enquiryId = enqHdrDM.getEnquiryId();
       logger.info(
           "Company ID : "
               + companyid
               + " | User Name : "
               + username
               + " > "
               + "Selected enquiryId. Id -> "
               + enquiryId);
       logger.info(
           "Company ID : "
               + companyid
               + " | User Name : "
               + username
               + " > "
               + "Selected enquiryId. Id -> "
               + enquiryId);
       cbBranch.setValue(enqHdrDM.getBranchId());
       tfEnqNo.setReadOnly(false);
       tfEnqNo.setValue(enqHdrDM.getEnquiryNo());
       tfEnqNo.setReadOnly(true);
       dfEnqDate.setValue(enqHdrDM.getEnquiryDate());
       dfDueDate.setValue(enqHdrDM.getDueDate());
       for (EnquiryVendorDtlDM enquiryVendorDtlDM :
           serviceEnquiryVendorDtl.getpurchasevdrdtl(null, enquiryId, null)) {
         lsVendorName.select(enquiryVendorDtlDM.getVendorid().toString());
       }
       if (enqHdrDM.getEnquiryStatus() != null) {
         cbEnqStatus.setValue(enqHdrDM.getEnquiryStatus());
       }
       if (enqHdrDM.getEnqRemark() != null) {
         taEnqRem.setValue(enqHdrDM.getEnqRemark().toString());
       }
       listEnqDtls =
           serviceSmsPurEnqDtl.getSmsPurEnqDtlList(
               null, enquiryId, null, (String) cbEnqDtlStatus.getValue());
     }
     loadPurDtl();
     comments =
         new SmsComments(
             vlTableForm,
             null,
             companyid,
             enquiryId,
             null,
             null,
             null,
             null,
             null,
             null,
             null,
             null,
             status,
             null);
     comments.loadsrch(
         true, null, null, enquiryId, null, null, null, null, null, null, null, null, null, null);
   } catch (Exception e) {
     logger.info(e.getMessage());
   }
 }