예제 #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());
   }
 }