/** * 功能:更新资产地点表(EAM)表“ETS_OBJECT”数据。 * * @param workorderObjectNo String * @param objAttibute EtsObjectAttributeDTO * @return boolean */ public boolean updateData(String workorderObjectNo, EtsObjectAttributeDTO objAttibute) throws DataHandleException { boolean operateResult = false; boolean autoCommit = false; boolean hasError = true; try { autoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); super.updateData(); // 表修改操作 // EtsObjectAttributeDTO objDTO2 = new EtsObjectAttributeDTO(); objAttibute.setObjectNo(workorderObjectNo); EtsObjectAttributeDAO dao = new EtsObjectAttributeDAO(sfUser, objAttibute, conn); dao.deleteData(); // EtsObjectAttributeDAO dao2 = new EtsObjectAttributeDAO(sfUser,objAttibute,conn); dao.createData(); // 插入操作 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.SQL_ERROR); } } return operateResult; }
/** * 功能:插入资产地点表(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; }