Exemplo n.º 1
0
  public static void initWhereLimit(
      DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {
    String userId = sessionInfo.getUserId();
    if (!"SYS".equals(userId)) {
      String issql = " select count(1) num ";
      issql = issql + " from dkworkgrpmst a ";
      issql = issql + " left join dkworkgrpposlnk c on a.workgrp_id=c.workgrp_id ";
      issql = issql + " left join cmpositionmst d on c.pos_no=d.position_no ";
      issql = issql + " left join cmempposmst e on d.position_no=e.position_no ";
      issql = issql + " left join cmempmst f on e.emp_no=f.emp_no  ";
      issql = issql + " where f.emp_id='" + userId + "' and a.workgrp_id='XMXICK' ";
      String num = Database.getValue(issql);
      if (!num.equals("1")) {
        String pkField = dataDom.getRootTable().getPkFieldName();
        String tableName = dataDom.getRootTable().getName();
        String wfSql = JHSMMST.getUsrWfSql(tableName, userId); // 当前用户有关的工作流记录数据

        String lmt =
            "1=1 AND ( PRJ_FMNG='"
                + userId
                + "' or PRJ_SMNG='"
                + userId
                + "' or FSTUSR_ID='"
                + userId
                + "' or "
                + pkField
                + " in ("
                + wfSql
                + "))";

        dataDom.getRootTable().getWhereLimit().addColumn("new_sql_wherelimit", lmt);
      }
    }
  }
Exemplo n.º 2
0
 public void reStartPrj(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {
   String pkValue = dataDom.getRootTable().getPkValue();
   if ((pkValue != null) && (!"".equals(pkValue))) {
     CommSequence cs = CommSequence.getInstance("YXPRJMST_SEQ");
     CommCodeNumber KLTYPID =
         new CommCodeNumber("PRJ", sessionInfo.getCurrentLanguage(), sessionInfo.getUserId());
     String newPk = cs.getNextValue();
     String prjNam = dataDom.getRootTable().getSafeRowColumnValue("PRJ_NAM");
     String rSql =
         "declare v_wkpl YXPRJMST%rowtype; zbTime  yxprjmst.ZB_TIMES%type; begin select * into v_wkpl from YXPRJMST where PRJ_NO ="
             + pkValue
             + ";"
             + " v_wkpl.OLD_PRJ := v_wkpl.PRJ_NO;"
             + " v_wkpl.PRJ_NO := "
             + newPk
             + ";"
             + " select nvl(max(ZB_TIMES),v_wkpl.ZB_TIMES) into zbTime from YXPRJMST where PRJ_NAM ='"
             + prjNam
             + "';"
             + " v_wkpl.ZB_TIMES := zbTime+1;"
             + " v_wkpl.VALID_STA := 'A';"
             + " v_wkpl.VEN_NO := null;"
             + " v_wkpl.ZB_ID := null;"
             + " v_wkpl.PRJ_STA := '00';"
             + " v_wkpl.PRJ_STAG := '01';"
             + " v_wkpl.PRJ_ID := '"
             + KLTYPID.getNextValue()
             + "';"
             + " v_wkpl.FSTUSR_DTM := sysdate;"
             + " v_wkpl.FSTUSR_ID := '"
             + sessionInfo.getUserId()
             + "';"
             + " insert into YXPRJMST values v_wkpl;"
             + "end;";
     Database.execString(rSql);
     setForwardURL(Tools.getProgramURL(dataDom, "B1YXM00030", "jsp?pkValue=" + newPk));
   } else {
     serviceRequest.getMessage().addError("请先维护主表!");
   }
 }
Exemplo n.º 3
0
 public void initData(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {
   Table table = dataDom.getRootTable();
   Row row = table.getRow(0L);
   if (row == null) {
     row = new Row(false, 0, 0, "new");
     table.addRow(row);
   }
   String pkValue = table.getPkValue();
   if ((pkValue == null) || ("".equals(pkValue)) || ("-1".equals(pkValue))) {
     String STA = table.getSafeRowColumnValue("DBJY_STA");
     if ("".equals(STA)) {
       table.getSafeRow().addColumn("DBJY_EXT01", sessionInfo.getUserId());
       table.setSafeRowColumnValue("DBJY_STA", "00");
     }
   }
 }
Exemplo n.º 4
0
 public void save(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest)
     throws LiemsException {
   Table table = dataDom.getTable("YXPBPFMST");
   Row currRow = table.getRow(0L);
   if (currRow == null) {
     table.addRow(new Row(false, 0, 0, "new"));
     currRow = table.getRow(0L);
   }
   currRow.setFirstLastUserInfo(sessionInfo.getUserId());
   try {
     super.save(dataDom, sessionInfo, serviceRequest);
   } catch (Exception e) {
     Log.error(e);
     serviceRequest.getMessage().addInfo("保存失败,请重试或联系系统管理员!");
   }
 }
Exemplo n.º 5
0
 public void save(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest)
     throws LiemsException {
   if (!saveBefore(dataDom, serviceRequest, sessionInfo)) {
     return;
   }
   Table table = dataDom.getTable("YXPRJMST");
   Database db = null;
   Row currRow = table.getRow(0L);
   if (currRow == null) {
     table.addRow(new Row(false, 0, 0, "new"));
     currRow = table.getRow(0L);
   }
   currRow.setFirstLastUserInfo(sessionInfo.getUserId());
   try {
     db = Tools.getDatabase(false);
     String isSplit = dataDom.getRootTable().getSafeRowColumnValue("IS_SPLIT");
     if (currRow.getDataStatus().equals("new")) {
       currRow.addColumn("ORG_NO", sessionInfo.getDefaultOrg());
       if ((currRow.getColumn("PRJ_ID") == null)
           || (currRow.getColumn("PRJ_ID").getValue() == null)
           || (currRow.getColumn("PRJ_ID").getValue().equals(""))) {
         String idTyp = currRow.getColumnValue("PRJ_EXT02");
         if ("A".equals(idTyp)) {
           CommCodeNumber KLTYPID =
               new CommCodeNumber(
                   "PRJ", sessionInfo.getCurrentLanguage(), sessionInfo.getUserId());
           currRow.addColumn(new Column("PRJ_ID", KLTYPID.getNextValue()));
         }
         CommCodeNumber ZB_ID =
             new CommCodeNumber("ZBBH", sessionInfo.getCurrentLanguage(), sessionInfo.getUserId());
         currRow.addColumn(new Column("ZB_ID", ZB_ID.getNextValue()));
         currRow.addColumn("VALID_STA", "A");
         currRow.addColumn(new Column("ZB_TIMES", "1"));
       }
       if ("N".equals(isSplit)) {
         Row row = new Row(false, 0, 0, "new");
         row.addColumn("PRJL_NAM", currRow.getColumnValue("PRJ_NAM"));
         row.addColumn("PRJL_ID", currRow.getColumnValue("PRJ_ID"));
         row.addColumn("BZ_AMT", "0.00");
         row.addColumn("IS_FB", "Y");
         dataDom.getChildTable().getRows().put("0", row);
       }
     }
     String dlfTyp = dataDom.getRootTable().getSafeRowColumnValue("DLF_TYP");
     super.save(dataDom, sessionInfo, serviceRequest, db);
     db.commit();
     String pkValue = currRow.getPkValue("PRJ_NO");
     if (isSplit.equals("Y")) {
       String sql = "";
       if (dlfTyp.equals("B")) {
         sql =
             "update YXPRJMST set ZBS_AMT = (select sum(ZBS_AMT) from YXPRJLIN where PRJ_NO="
                 + pkValue
                 + "),"
                 + "BZ_AMT = (select sum(BZ_AMT) from YXPRJLIN where PRJ_NO="
                 + pkValue
                 + "),"
                 + "DL_AMT=(select sum(DLFL_AMT) from YXPRJLIN where PRJ_NO="
                 + pkValue
                 + ")"
                 + " where PRJ_NO = "
                 + pkValue;
         dataDom.getChildTable().getField("DLFL_AMT").setReadonly(false);
       } else {
         sql =
             "update YXPRJMST set ZBS_AMT = (select sum(ZBS_AMT) from YXPRJLIN where PRJ_NO="
                 + pkValue
                 + "),"
                 + "BZ_AMT = (select sum(BZ_AMT) from YXPRJLIN where PRJ_NO="
                 + pkValue
                 + ")"
                 + " where PRJ_NO = "
                 + pkValue;
         dataDom.getChildTable().getField("DLFL_AMT").setReadonly(true);
       }
       Database.execString(sql);
     }
     serviceRequest.getMessage().addInfo("保存成功");
     initSel(dataDom);
     dataDom.getChildTable().getWhereLimit().addColumn("PRJ_NO", pkValue);
     dataDom.refresh(sessionInfo);
   } catch (Exception e) {
     if (db != null) {
       db.rollback();
     }
     Log.error(e);
     serviceRequest.getMessage().addInfo("保存失败,请重试或联系系统管理员!");
   } finally {
     if (db != null) {
       db.cleanup();
     }
   }
 }
Exemplo n.º 6
0
  /**
   * 招标代理费生成
   *
   * @param dataDom
   * @param sessionInfo
   * @param serviceRequest
   * @throws LiemsException
   */
  public void creatDLFEE(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest)
      throws LiemsException {
    Database db = null;
    Table table = dataDom.getTable("YXDBJYMST");
    Row currRow = table.getRow(0L);
    try {
      db = Tools.getDatabase(true);
      String DBJY_NO = currRow.getColumnValue("DBJY_NO");
      String PRJ_NO = currRow.getColumnValue("PRJ_NO");
      String ORG_NO = currRow.getColumnValue("ORG_NO");
      Vector<String> vc = new Vector<String>();
      String sel1 =
          "select distinct TBR_NO from YXDBJYLIN where DBJY_NO=" + DBJY_NO + " and IS_ZB='01'";
      Rowset rs = db.getRS(sel1);
      while (rs.next()) {
        // 查询投标单位 生成主表
        String TBR_NO = rs.getString("TBR_NO");
        CommSequence cs = CommSequence.getInstance("YXDLFMST_SEQ");
        String TBDJ_NO = cs.getNextValue();
        CommCodeNumber seq =
            new CommCodeNumber(
                "DLF", sessionInfo.getCurrentLanguage(), sessionInfo.getUserId(), db);
        String TBDJ_ID = seq.getNextValue();
        String insertSQL =
            " insert into YXDLFMST(DLF_NO,ORG_NO,DLF_STA,DLF_ID,PRJ_NO,TBR_NO,FSTUSR_ID,FSTUSR_DTM) "
                + " values("
                + TBDJ_NO
                + ","
                + ORG_NO
                + ",'00','"
                + TBDJ_ID
                + "',"
                + PRJ_NO
                + ",'"
                + TBR_NO
                + "','"
                + sessionInfo.getUserId()
                + "',sysdate) ";
        vc.add(insertSQL);
        // 查询标包 生成子表明细数据
        String sel2 =
            "select YXDBJYLIN.PRJL_NO,YXPRJLIN.DLFL_AMT from YXDBJYLIN,YXPRJLIN "
                + " where YXDBJYLIN.PRJL_NO=YXPRJLIN.PRJL_NO and YXDBJYLIN.TBR_NO = "
                + TBR_NO
                + " and YXDBJYLIN.DBJY_NO="
                + DBJY_NO
                + " and YXDBJYLIN.IS_ZB='01'";
        Rowset rs2 = db.getRS(sel2);
        while (rs2.next()) {
          String PRJL_NO = rs2.getString("PRJL_NO");
          CommSequence cs2 = CommSequence.getInstance("YXDBJYLIN_SEQ");
          String TBDJL_NO = cs2.getNextValue();
          String DLFL_AMT = rs2.getString("DLFL_AMT");
          insertSQL =
              " insert into YXDBJYLIN(DLFL_NO,DLF_NO,TBR_NO,PRJ_NO,PRJL_NO,DLFL_AMT,IS_JF) "
                  + " values("
                  + TBDJL_NO
                  + ","
                  + TBDJ_NO
                  + ","
                  + TBR_NO
                  + ","
                  + PRJ_NO
                  + ","
                  + PRJL_NO
                  + ","
                  + DLFL_AMT
                  + ", 'N')";
          vc.add(insertSQL);
        }
      }

      db.execSqlUpdateBatch(vc);
      db.commit();
      serviceRequest.addServiceReturnParameter("relString", "true");
    } catch (Exception e) {
      e.printStackTrace();
      serviceRequest.addServiceReturnParameter("relString", e.toString());
    } finally {
      if (db != null) {
        db.cleanup();
      }
    }
  }
Exemplo n.º 7
0
  public void save(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest)
      throws LiemsException {
    Table table = dataDom.getTable("YXDBJYMST");
    Table cTable = dataDom.getTable("YXDBJYLIN");
    Row currRow = table.getRow(0L);
    if (currRow == null) {
      table.addRow(new Row(false, 0, 0, "new"));
      currRow = table.getRow(0L);
    }

    currRow.setFirstLastUserInfo(sessionInfo.getUserId());
    String prjNo = currRow.getColumnValue("PRJ_NO");
    Database db = null;
    try {
      db = Tools.getDatabase(false);
      if (currRow.getDataStatus().equals("new")) {
        currRow.addColumn("ORG_NO", sessionInfo.getDefaultOrg());
        if ((currRow.getColumn("DBJY_ID") == null)
            || (currRow.getColumn("DBJY_ID").getValue() == null)
            || (currRow.getColumn("DBJY_ID").getValue().equals(""))) {
          CommCodeNumber KLTYPID =
              new CommCodeNumber("DBJY", sessionInfo.getCurrentLanguage(), sessionInfo.getUserId());
          currRow.addColumn(new Column("DBJY_ID", KLTYPID.getNextValue()));
        }
      } else if ((currRow.getDataStatus().equals("modified"))
          && (CheckDate.isPrjNoChange(dataDom, db))) {
        deleteChildTable(dataDom, sessionInfo, serviceRequest, db);
      }
      String isSplit = Database.getValue(db, "select IS_SPLIT from YXPRJMST where PRJ_NO=" + prjNo);
      if ((prjNo != null) && (!(prjNo.equals(""))) && (Integer.parseInt(prjNo) > 0)) {
        if ((isSplit.equals("Y"))
            && (CheckDate.isTableEmpty(
                "YXDBJYLIN", dataDom, db, "PRJ_NO=" + prjNo, currRow.getPkValue("DBJY_NO"))))
          initTBRTable(dataDom, prjNo, db);
        else if ((isSplit.equals("N"))
            && (CheckDate.isTableEmpty(
                "YXDBJYLIN", dataDom, db, "PRJ_NO=" + prjNo, currRow.getPkValue("DBJY_NO")))) {
          initNoSplitTbrTab(dataDom, prjNo, db);
        }
      }
      super.save(dataDom, sessionInfo, serviceRequest, db);
      String pkValue = dataDom.getRootTable().getPkValue();
      //
      String selString =
          "select PRJL_NO,dlf_sum from YXDBJYLIN where DBJY_NO="
              + pkValue
              + " and dlf_sum is not null";
      Rowset rs = db.getRS(selString);
      Vector<String> vc = new Vector<String>();
      while (rs.next()) {
        String PRJL_NO = rs.getString("PRJL_NO");
        String dlf_sum = Charset.nullToEmpty(rs.getString("dlf_sum"));
        if (!"".equals(dlf_sum)) {
          String upPrjInfoString =
              "update yxprjlin set DLFL_AMT="
                  + dlf_sum
                  + " where PRJ_NO="
                  + prjNo
                  + " and prjl_no="
                  + PRJL_NO;
          vc.add(upPrjInfoString);
        }
      }
      if (vc.size() > 0) {
        db.execSqlUpdateBatch(vc);
      }
      db.commit();
    } catch (Exception e) {
      db.rollback();
      table.refresh("B1YXM00200", sessionInfo);
      Log.error(e);
      serviceRequest.getMessage().addInfo("保存失败");
    } finally {
      if (db != null) {
        db.cleanup();
      }
    }
    initSel(dataDom, sessionInfo);
    dataDom.getChildTable().refresh("B1YXM00200", sessionInfo);
  }