예제 #1
0
 /**
  * 保存
  *
  * @return
  */
 public boolean doSave() {
   boolean operateResult = false;
   boolean autoCommit = true;
   try {
     autoCommit = conn.getAutoCommit();
     conn.setAutoCommit(false);
     headerDTO.setTransStatus(AssetsDictConstant.SAVE_TEMP);
     this.saveHeader();
     this.saveLines();
     operateResult = super.processProcedure(false);
   } catch (SQLException ex) {
     Logger.logError(ex);
   } catch (DataHandleException ex) {
     Logger.logError(ex);
   } finally {
     try {
       if (!operateResult) {
         this.msg = "保存失败";
         conn.rollback();
       } else {
         this.msg = "保存成功";
         conn.commit();
       }
       conn.setAutoCommit(autoCommit);
     } catch (SQLException ex) {
       Logger.logError(ex);
     }
   }
   return operateResult;
 }
예제 #2
0
 /**
  * 保存头
  *
  * @throws DataHandleException
  * @throws SQLException
  */
 public void saveHeader() throws DataHandleException, SQLException {
   if (headerDTO.getTransNo().equals(AssetsWebAttributes.ORDER_AUTO_PROD)) {
     if (StrUtil.isEmpty(headerDTO.getTransId())) {
       SeqProducer seqProducer = new SeqProducer(conn);
       String transId = seqProducer.getGUID();
       headerDTO.setTransId(transId);
     }
     String companyCode = userAccount.getCompanyCode(); // 还是采用该方法,以下考虑周子君认为没必要
     String transType = headerDTO.getTransType();
     OrderNumGenerator numberProducer = new OrderNumGenerator(conn, companyCode, transType);
     headerDTO.setTransNo(numberProducer.getOrderNum());
     headerDAO.createHeader(headerDTO);
   } else {
     headerDAO.updateHeader(headerDTO);
   }
 }
예제 #3
0
  /**
   * 取头信息
   *
   * @throws QueryException
   */
  protected void prodHeader() throws QueryException {
    headerDAO.setDTOClassName(UrgentHeaderDTO.class.getName());
    headerDAO.setCalPattern(CalendarConstant.LINE_PATTERN);

    UrgentHeaderDTO tmpDTO = (UrgentHeaderDTO) headerDTO.clone();

    headerDTO = (UrgentHeaderDTO) headerDAO.getDataByPrimaryKey();
    // 当新建时候
    if (null == headerDTO || StrUtil.isEmpty(headerDTO.getTransId())) {
      headerDTO = new UrgentHeaderDTO();
      headerDTO = initHeaderData(headerDTO);
    }
    headerDTO.setSf_task_attribute3(tmpDTO.getSf_task_attribute3());

    leaseDTO.setHeaderDTO(headerDTO);
  }
예제 #4
0
  /**
   * 初始化头信息
   *
   * @param dto
   * @return
   */
  private UrgentHeaderDTO initHeaderData(UrgentHeaderDTO dto) {
    dto.setTransNo(AssetsWebAttributes.ORDER_AUTO_PROD); // 设置单据号
    dto.setCreatedBy(userAccount.getUserId()); // 设置创建人
    dto.setCreated(userAccount.getUsername()); // 设置创建人
    dto.setFromOrganizationId(userAccount.getOrganizationId());
    dto.setFromCompanyName(userAccount.getCompany());
    dto.setTransTypeValue(UrgentAppConstant.TRANS_TYPE_NAME);
    dto.setTransType(UrgentAppConstant.TRANS_TYPE);
    dto.setTransStatusName("新增");
    dto.setCurrCreationDate();

    return dto;
  }
예제 #5
0
 /**
  * 将流程中保存的单据ID设置进DTO
  *
  * @param dtoParameter
  * @return
  */
 protected UrgentHeaderDTO setFlowIdToDTO(UrgentHeaderDTO dtoParameter) {
   if (StrUtil.isEmpty(dtoParameter.getTransId())) {
     dtoParameter.setTransId(StrUtil.nullToString(dtoParameter.getApp_dataID()));
   }
   return dtoParameter;
 }
예제 #6
0
 /** 功能:准备流程数据,由应用实现 */
 protected void prepareProcedureData() {
   flowDTO.setApp_dataID(headerDTO.getTransId());
   flowDTO.setPrimaryKey(headerDTO.getTransId());
   flowDTO.setOrderNo(headerDTO.getTransNo());
   flowDTO.setOrderName(ORDER_TITLE);
 }
예제 #7
0
 /**
  * 取行信息
  *
  * @throws QueryException
  */
 protected void prodLines() throws QueryException {
   lines = headerDAO.getLinesData(headerDTO.getTransId());
   leaseDTO.setLines(lines);
 }