Example #1
0
  /**
   * 功能:修改数据。
   *
   * @return boolean
   */
  public boolean deleteNullData() throws DataHandleException {
    boolean operateResult = false;
    boolean autoCommit = false;
    boolean hasError = true;
    try {
      autoCommit = conn.getAutoCommit();
      conn.setAutoCommit(false);
      AmsHouseInfoDTO HLDTO = (AmsHouseInfoDTO) dtoParameter;
      AmsHouseInfoModel model = new AmsHouseInfoModel(userAccount, HLDTO);
      SQLModel sqlModel1 = model.deleteUsesInfo();
      DBOperator.updateRecord(sqlModel1, conn);

      String barcode = HLDTO.getBarcode();

      //            super.updateData();            //对表AMS_house_INFO进行修改操作

      GetMisHousInfoModel updateEII = new GetMisHousInfoModel(userAccount, HLDTO);
      SQLModel nullSqlModel = updateEII.updateNull(HLDTO.getBarcode());
      DBOperator.updateRecord(nullSqlModel, conn);

      //            itemInfoDTO.setBarcode(HLDTO.getBarcode());       // 标签号
      //            itemInfoDTO.setItemCode(HLDTO.getItemCode());          //分类编码
      //            itemInfoDTO.setSystemid(HLDTO.getSystemId());          //  根据SYSTEMID进行修改;

      // --------------对表 AMS_ITEM_FILES  进行修改操作   先删除再增加
      AmsItemFilesModel sqlModel = new AmsItemFilesModel(userAccount, null);
      DBOperator.updateRecord(sqlModel.getDeleteModel(barcode), conn);
      operateResult = true;
      conn.commit();
      hasError = false;
      prodMessage(MsgKeyConstant.UPDATE_DATA_SUCCESS);
      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;
  }
Example #2
0
 /** 功能:获取并更新不能报废的资产,并更新行表REMARK为“不允许报废”; */
 private void updateTransLineRemark(String[] barcodes) throws DataHandleException {
   OrderApproveModel modelProducer = (OrderApproveModel) sqlProducer;
   String aggBarcodes = initBarcodes(barcodes);
   //        SQLModel sqlModel = modelProducer.updateTransLineRemark(aggBarcodes);
   SQLModel sqlModel = modelProducer.updateTransLineRemark();
   DBOperator.updateRecord(sqlModel, conn);
 }
Example #3
0
 /** 功能:特殊处理,先清除选中资产REMARK */
 private void deleteTransLineRemark(String[] barcodes) throws DataHandleException {
   OrderApproveModel modelProducer = (OrderApproveModel) sqlProducer;
   for (int i = 0; i < barcodes.length; i++) {
     String barcode = barcodes[i];
     SQLModel sqlModel = modelProducer.deleteTransLineRemark(barcode);
     DBOperator.updateRecord(sqlModel, conn);
   }
 }
Example #4
0
 /**
  * 功能:插入ets_item_info
  *
  * @throws QueryException
  * @throws DataHandleException
  */
 private void insertEtsItemInfo(EtsItemInfoDTO etsItemInfo) throws DataHandleException {
   SQLModel sqlModel = null;
   try {
     sqlModel = modelProducer.getItemCreateModel(etsItemInfo);
     DBOperator.updateRecord(sqlModel, conn);
   } catch (SQLModelException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   }
 }
Example #5
0
 /**
  * 功能:插入ETS_PA_PROJECTS_ALL
  *
  * @throws QueryException
  * @throws DataHandleException
  */
 private void insertProjectInfo(EtsItemInfoDTO itemDTO, EtsFaAssetsDTO faDTO)
     throws DataHandleException {
   SQLModel sqlModel = null;
   try {
     sqlModel = modelProducer.getProjectCreateModel(itemDTO, faDTO);
     DBOperator.updateRecord(sqlModel, conn);
   } catch (SQLModelException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   }
 }
Example #6
0
 public void deleteRentData() throws SQLModelException { // 执行AMS_RENT_INFO 表的新增操作
   try {
     GetMisHousInfoModel getMisHousInfoModel = (GetMisHousInfoModel) sqlProducer;
     SQLModel sqlModel = getMisHousInfoModel.doDeleteRentData();
     DBOperator.updateRecord(sqlModel, conn);
     prodMessage(CustMessageKey.ENABLE_SUCCESS);
     getMessage().addParameterValue("土地数据");
   } catch (DataHandleException ex) {
     prodMessage(CustMessageKey.ENABLE_FAILURE);
     getMessage().addParameterValue("土地数据");
     ex.printLog();
   }
 }
Example #7
0
 public void saveUses(DTOSet lineSet) throws DataHandleException, QueryException {
   AmsHouseInfoDTO houseDTO = (AmsHouseInfoDTO) dtoParameter;
   if (lineSet != null && !lineSet.isEmpty()) {
     for (int i = 0; i < lineSet.getSize(); i++) {
       AmsHouseUsesDTO lineData = (AmsHouseUsesDTO) lineSet.getDTO(i);
       lineData.setBarcode(houseDTO.getBarcode());
       if (!(lineData.getArea().equals("") || lineData.getUsage().equals(""))) {
         GetMisHousInfoModel model = new GetMisHousInfoModel(userAccount, houseDTO);
         SQLModel sqlModel = model.insertUsesInfo(lineData);
         DBOperator.updateRecord(sqlModel, conn);
       }
     }
   }
 }
Example #8
0
 public void efficientData(String[] barcodes) { // 执行批量生效效操作
   //		EtsObjectDTO dtoPara = (EtsObjectDTO) dtoParameter;
   AmsHouseInfoDTO landDTO = (AmsHouseInfoDTO) dtoParameter;
   try {
     SQLModel sqlModel = modelProducer.UpdateBarsModel(barcodes);
     DBOperator.updateRecord(sqlModel, conn);
     prodMessage(CustMessageKey.ENABLE_SUCCESS);
     getMessage().addParameterValue("重置");
   } catch (DataHandleException ex) {
     prodMessage(CustMessageKey.ENABLE_FAILURE);
     getMessage().addParameterValue("重置");
     ex.printLog();
   }
 }
Example #9
0
 public void truncateData(String tableName, Connection conn) {
   //                Connection conn = null;
   try {
     //                    conn = DBManager.getDBConnection();
     SQLModel sqlModel = new SQLModel();
     String sqlStr = "TRUNCATE TABLE  " + tableName;
     sqlModel.setSqlStr(sqlStr);
     DBOperator.updateRecord(sqlModel, conn);
   } catch (Exception e) {
     e.printStackTrace();
   } /*finally {
         DBManager.closeDBConnection(conn);
     }*/
 }
Example #10
0
 /**
  * 功能:批量撤销工单批
  *
  * @param batchIds String[]
  * @param singleCancel boolean
  */
 public void cancelOrderBatchs(String[] batchIds, boolean singleCancel) {
   boolean operateResult = false;
   boolean autoCommit = true;
   EamDhCheckBatchDTO dto = (EamDhCheckBatchDTO) dtoParameter;
   try {
     EamDhCheckBatchModel modelProducer = (EamDhCheckBatchModel) sqlProducer;
     SQLModel sqlModel = modelProducer.getMulBatchCancelModel(batchIds);
     DBOperator.updateRecord(sqlModel, conn);
     EamDhCheckHeaderDAO headerDAO = new EamDhCheckHeaderDAO(userAccount, null, conn);
     headerDAO.cancelOrders(batchIds);
     setDTOParameter(dto);
     operateResult = true;
   } catch (DataHandleException ex) {
     ex.printLog();
   } finally {
     try {
       if (operateResult) {
         conn.commit();
         if (singleCancel) { // 详细信息页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_CANCEL_SUCCESS);
         } else { // 列表页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_MULCEL_SUCCESS);
         }
       } else {
         conn.rollback();
         if (singleCancel) { // 详细信息页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_CANCEL_FAILURE);
         } else { // 列表页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_MULCEL_FAILURE);
         }
         message.setIsError(true);
       }
       conn.setAutoCommit(autoCommit);
     } catch (SQLException ex) {
       Logger.logError(ex);
     }
   }
 }
Example #11
0
 public void updateInEII() throws DataHandleException {
   AmsCabelInfoModel modelClass = (AmsCabelInfoModel) sqlProducer;
   SQLModel sqlModel = modelClass.getUpdateInEIIModel();
   DBOperator.updateRecord(sqlModel, conn);
 }
Example #12
0
 public void inAOAData() throws DataHandleException { // 执行插入AOA表操作
   EtsObjectModel etsObjectModel = (EtsObjectModel) sqlProducer;
   SQLModel sqlModel = etsObjectModel.getAOACreateModel();
   DBOperator.updateRecord(sqlModel, conn);
 }
Example #13
0
 public void inureData() throws DataHandleException { // 执行生效操作
   EtsObjectModel etsObjectModel = (EtsObjectModel) sqlProducer;
   SQLModel sqlModel = etsObjectModel.getInureModel();
   DBOperator.updateRecord(sqlModel, conn);
 }
Example #14
0
 public void efficientData(String[] workorderObjectNos) throws DataHandleException { // 执行批量生效效操作
   EtsObjectModel etsObjectModel = (EtsObjectModel) sqlProducer;
   SQLModel sqlModel = etsObjectModel.getEfficientModel(workorderObjectNos);
   DBOperator.updateRecord(sqlModel, conn);
 }
Example #15
0
  /**
   * 功能:审批单据,含调拨单,报废单,处置单,共享单
   *
   * @param flowDTO FlowDTO
   * @param orderLines 更改调拨单行的折旧费用账户(2008-12-01 17:37)
   * @return boolean
   */
  public boolean approveOrder(FlowDTO flowDTO, DTOSet orderLines) {
    boolean operateResult = false;
    boolean autoCommit = true;
    boolean needMsg = true;
    String flowCode = "";
    try {
      if (canApprove()) {
        autoCommit = conn.getAutoCommit();
        conn.setAutoCommit(false);
        FreeFlowDTO dto = (FreeFlowDTO) dtoParameter;
        flowCode = dto.getFlowCode();
        flowDTO.setProcName(dto.getProcdureName());
        flowDTO.setActivity(flowCode);
        flowDTO.setApplyId(dto.getTransId());
        flowDTO.setSessionUserId(userAccount.getUserId());
        flowDTO.setSessionUserName(userAccount.getUsername());
        flowDTO.setApplyNo(dto.getTransNo());
        FlowAction flowProcessor = new FlowAction(conn, flowDTO);
        boolean flow2End = flowProcessor.isFlowToEnd();
        dto.setFlow2End(flow2End);
        setDTOParameter(dto);
        if (flowCode.equals(FlowConstant.FLOW_CODE_NEXT)) {
          if (flow2End) {
            dto.setTransStatus(AssetsDictConstant.COMPLETED);
          } else {
            dto.setTransStatus(AssetsDictConstant.IN_PROCESS);
          }
          flowProcessor.flow();
        } else {
          dto.setTransStatus(AssetsDictConstant.REJECTED);
          flowProcessor.reject2Begin();
        }
        setDTOParameter(dto);
        OrderApproveModel modelProducer = (OrderApproveModel) sqlProducer;
        SQLModel sqlModel = modelProducer.getOrderApproveModel();
        DBOperator.updateRecord(sqlModel, conn);

        String provinceCode = servletConfig.getProvinceCode();
        if (provinceCode.equals(AssetsDictConstant.PROVINCE_CODE_JIN)
            && flowCode.equals(FlowConstant.FLOW_CODE_NEXT)) { // 仅山西需要该功能。
          if (dto.getTransferType().equals("BTW_COMP")) {
            AmsAssetsTransLineDAO lineDAO = new AmsAssetsTransLineDAO(userAccount, null, conn);
            lineDAO.uodateAccount(orderLines);
          }
        }
        if (flow2End && flowCode.equals(FlowConstant.FLOW_CODE_NEXT)) {
          sqlModel = modelProducer.getLineStatusUpdateModel(); // 更新资产单据行数据状态为已审批
          DBOperator.updateRecord(sqlModel, conn);
          if (dto.getTransType().equals(AssetsDictConstant.ASS_DIS)) { // 报废
            sqlModel = modelProducer.getAssetsDiscardModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
            if (provinceCode.equals(AssetsDictConstant.PROVINCE_CODE_SX)) { // 山西省报废要同步
              recordChkLog(AssetsDictConstant.ASS_DIS, AssetsDictConstant.STATUS_NO);
            }
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_CLR)) { // 处置
            sqlModel = modelProducer.getAssetsClearModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_FREE)) { // 闲置
            sqlModel = modelProducer.getAssetsFreeModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_SUB)) { // 减值
            sqlModel = modelProducer.getAssetsSubModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_SHARE)) { // 共享
            sqlModel = modelProducer.getAssetsShareModel();
            DBOperator.updateRecord(sqlModel, conn);
          }
        }
        operateResult = true;
      } else {
        prodMessage(AssetsMessageKeys.APPROVE_INVALID);
        message.setIsError(!operateResult);
        needMsg = false;
      }
    } catch (DataHandleException ex) {
      ex.printLog();
    } catch (SQLException ex) {
      Logger.logError(ex);
    } catch (ContainerException ex) {
      ex.printLog();
    } catch (QueryException ex) {
      ex.printLog();
    } finally {
      try {
        if (!operateResult) {
          conn.rollback();
        } else {
          conn.commit();
        }
        conn.setAutoCommit(autoCommit);
        if (needMsg) {
          processMessage(operateResult, flowCode);
        }
      } catch (SQLException ex1) {
        Logger.logError(ex1);
      }
    }
    return operateResult;
  }
Example #16
0
 /**
  * 功能:插入ams_house_info
  *
  * @throws QueryException
  * @throws DataHandleException
  */
 private void insertHouesInfo(AmsHouseInfoDTO houseDTO) throws DataHandleException {
   SQLModel sqlModel = modelProducer.insertHouse(houseDTO);
   DBOperator.updateRecord(sqlModel, conn);
 }
Example #17
0
  /**
   * 功能:修改数据。
   *
   * @return boolean
   */
  public boolean updateData(
      EtsItemInfoDTO itemInfoDTO, AmsItemFilesDTO fileDTO, String[] filePaths, DTOSet lineSet)
      throws DataHandleException {
    boolean operateResult = false;
    boolean autoCommit = false;
    boolean hasError = true;
    try {
      autoCommit = conn.getAutoCommit();
      conn.setAutoCommit(false);
      AmsHouseInfoDTO HLDTO = (AmsHouseInfoDTO) dtoParameter;
      AmsHouseInfoModel model = new AmsHouseInfoModel(userAccount, HLDTO);
      SQLModel sqlModel1 = model.deleteUsesInfo();
      DBOperator.updateRecord(sqlModel1, conn);

      String barcode = HLDTO.getBarcode();
      super.updateData(); // 对表AMS_house_INFO进行修改操作

      itemInfoDTO.setBarcode(HLDTO.getBarcode()); // 标签号
      itemInfoDTO.setItemCode(HLDTO.getItemCode()); // 分类编码
      itemInfoDTO.setSystemid(HLDTO.getSystemId()); //  根据SYSTEMID进行修改;

      if (!HLDTO.getTemp().equals("Y")) {
        GetMisHousInfoModel updateEII = new GetMisHousInfoModel(userAccount, HLDTO);
        SQLModel eiiSqlModel = updateEII.getEiiData(HLDTO.getBarcode());
        DBOperator.updateRecord(eiiSqlModel, conn);
      }

      //            EtsItemInfoDAO itemInfoDAO = new EtsItemInfoDAO(userAccount,itemInfoDTO,conn);
      //            itemInfoDAO.updateData();              //对表ETS_ITEM_INFO进行修改操作

      //            if (landDTO.getIsRent().equals("Y")) {        //表 AMS_RENT_INFO (RENT_ID ) 修改
      // 先删除 再增加
      //                deleteRentData();
      //                creatRentData();
      //            } else {
      //                deleteRentData();          //对表  AMS_RENT_INFO 进行删除操作
      //            }
      saveUses(lineSet);
      // --------------对表 AMS_ITEM_FILES  进行修改操作   先删除再增加
      AmsItemFilesModel sqlModel = new AmsItemFilesModel(userAccount, fileDTO);
      DBOperator.updateRecord(sqlModel.getDeleteModel(barcode), conn);
      if (!StrUtil.isEmpty(filePaths)) {
        SeqProducer seq = new SeqProducer(conn);
        for (int i = 0; i < filePaths.length; i++) {
          fileDTO.setBarcode(barcode);
          String filedp[] = StrUtil.splitStr(filePaths[i], "$");
          fileDTO.setFileDesc(filedp[0]);
          fileDTO.setFilePath(filedp[1]);
          fileDTO.setSystemId(seq.getGUID());
          DBOperator.updateRecord(sqlModel.getCreateModel(), conn);
        }
      }
      operateResult = true;
      conn.commit();
      hasError = false;
      prodMessage(MsgKeyConstant.UPDATE_DATA_SUCCESS);
      getMessage().addParameterValue("未处置信息");
    } catch (SQLException ex) {
      Logger.logError(ex);
      prodMessage(MsgKeyConstant.SQL_ERROR);
      //        } catch (SQLModelException ex) {
      //            Logger.logError(ex);
      //            prodMessage(MsgKeyConstant.SQL_ERROR);
    } catch (QueryException e) {
      Logger.logError(e);
      //            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;
  }