コード例 #1
0
  /**
   * 功能:插入地点信息
   *
   * @throws DataHandleException
   */
  private void addAddressData(EtsFaAssetsDTO faDTO) throws DataHandleException, QueryException {
    try {
      EtsObjectDTO obDTO = new EtsObjectDTO();
      obDTO.setWorkorderObjectCode(faDTO.getAssetsLocationCode());
      obDTO.setWorkorderObjectName(faDTO.getAssetsLocation());
      obDTO.setWorkorderObjectLocation(faDTO.getAssetsLocation());
      obDTO.setOrganizationId(faDTO.getOrganizationId());
      obDTO.setObjectCategory("81");
      SQLModel sqlModel = modelProducer.getCount(faDTO.getDepreciationAccount().substring(5, 11));
      SimpleQuery sq = new SimpleQuery(sqlModel, conn);
      sq.executeQuery();
      if (sq.hasResult()) {
        Row row = sq.getFirstRow();
        obDTO.setCountyCode(row.getStrValue("COUNTY_CODE"));
      }
      if (obDTO.getWorkorderObjectName().equals("")) {
        return;
      }

      EtsObjectDAO etsObjectDAO = new EtsObjectDAO(userAccount, obDTO, conn);
      etsObjectDAO.createData2();
    } catch (ContainerException ex) {
      ex.printLog();
      throw new QueryException(ex);
    }
  }
コード例 #2
0
ファイル: EtsObjectDAO.java プロジェクト: starMagic/CQEAM
 /**
  * 功能:插入资产地点表(EAM)表“ETS_OBJECT”数据。
  *
  * @param objAttibute EtsObjectAttributeDTO
  * @return boolean
  */
 public boolean createData(EtsObjectAttributeDTO objAttibute)
     throws DataHandleException { // do _save 的 操作
   boolean operateResult = false;
   boolean autoCommit = false;
   boolean hasError = true;
   try {
     autoCommit = conn.getAutoCommit();
     conn.setAutoCommit(false);
     EtsObjectDTO objDTO = (EtsObjectDTO) dtoParameter;
     objDTO.setWorkorderObjectNo(getNextWorkorderObjectNo());
     setDTOParameter(objDTO);
     super.createData(); // 插入数据
     inAOAData();
     //                EtsObjectAttributeDTO objDTO2 = new EtsObjectAttributeDTO();
     //                objDTO2.setObjectNo(objDTO.getWorkorderObjectNo());
     // //获取 WORKORDER_OBJECT_NO
     //
     //
     objAttibute.setObjectNo(objDTO.getWorkorderObjectNo());
     EtsObjectAttributeDAO dao = new EtsObjectAttributeDAO(sfUser, objAttibute, conn);
     dao.createData(); // 根据WORKORDER_OBJECT_NO进行插入操作
     operateResult = true;
     conn.commit();
     hasError = false;
     getMessage().addParameterValue("资产地点表");
   } catch (SQLException ex) {
     Logger.logError(ex);
     prodMessage(MsgKeyConstant.SQL_ERROR);
   } finally {
     try {
       if (hasError) {
         conn.rollback(); // 回滚
       }
       conn.setAutoCommit(autoCommit); // 恢复以前状态
     } catch (SQLException ex) {
       Logger.logError(ex);
       prodMessage(MsgKeyConstant.ROLL_BACK_ERROR);
     }
   }
   return operateResult;
 }