Ejemplo n.º 1
0
  public void CST_NO_onblur(
      DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {
    Database db = null;
    Rowset rs = null;
    String sql = "";
    String cstNo = "";
    String cstId = "";
    String cstNam = "";

    try {
      db = Tools.getDatabase(true);
      cstId = Charset.nullToEmpty(serviceRequest.getParameter("value"));
      if (!cstId.equals("")) {
        sql = "select cst_no,cst_nam from ogcstmst where cst_id='" + cstId + "'";
        rs = db.getRS(sql);
        if (rs.getRowCount() <= 0) {
          serviceRequest.addServiceReturnParameter("CSTFLG", "FALSE");
          return;
        } else {
          if (rs.next()) {
            cstNo = Charset.nullToEmpty(rs.getString("cst_no"));
            cstNam = Charset.nullToEmpty(rs.getString("cst_nam"));
          }
        }
      }
      serviceRequest.addServiceReturnParameter("CSTFLG", "TRUE");
      serviceRequest.addServiceReturnParameter("CST_NO", cstNo);
      serviceRequest.addServiceReturnParameter("CST_NAM", cstNam);

    } catch (Exception e) {
      Log.error(e);
    } finally {
      if (db != null) db.cleanup();
    }
  }
Ejemplo n.º 2
0
 /**
  * 页面tab页签切换 @Override
  *
  * @param dataDom DataDom
  * @param sessionInfo SessionInfo
  * @param serviceRequest ServiceRequest 含有tabName参数
  * @throws LiemsException
  */
 public void TabOnClick(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {
   Table table = dataDom.getTable("YXPBPFLIN");
   if (null != table) {
     Field orgNoField = table.getField("ORG_NO");
     if (null != orgNoField) {
       Row currRow = table.getRow(0);
       String orgNo = "";
       // 增加当前行的判断,仅当当前行不为null时候取DataDom里的orgNo
       if (null != currRow) {
         orgNo = Charset.nullToEmpty(currRow.getColumnValue("ORG_NO"));
       }
       if (!("".equals(orgNo))) {
         serviceRequest.addParameter("selectorgno", orgNo);
       } else {
         serviceRequest.addParameter("selectorgno", sessionInfo.getOrg()[0].getValue());
       }
       // 没有公司编号字段,则取session中第一个公司编号
     } else {
       serviceRequest.addParameter("selectorgno", sessionInfo.getOrg()[0].getValue());
     }
   } else {
     serviceRequest.addParameter("selectorgno", sessionInfo.getOrg()[0].getValue());
   }
   super.TabOnClick(dataDom, sessionInfo, serviceRequest);
 }
Ejemplo n.º 3
0
  public String getTbrByPrjl(String org_no, HttpServletRequest request) {
    String prjlNo = Charset.nullToEmpty(request.getParameter("prjlNo"));
    String sql =
        "select p.TBR_NAM, p.TBR_NO  from YXTBRMST p  join YXBJDFLIN f on p.TBR_NO = f.TBR_NO  where f.PRJL_NO ="
            + prjlNo;
    String retval = Tools.getSelectJson(sql, true, false).toString();

    return retval;
  }
Ejemplo n.º 4
0
 public String setVenLxr(String org_no, HttpServletRequest request) {
   String venNo = Charset.nullToEmpty(request.getParameter("venNo"));
   String returnValue = "";
   String sql = "SELECT LXR_NAM FROM HLVDVENLIN WHERE VEN_NO=" + venNo;
   try {
     Rowset rs = Database.getRowset(sql);
     while (rs.next()) {
       String lixNam = Charset.nullToEmpty(rs.getString("LXR_NAM"));
       returnValue = returnValue + ",['" + lixNam + "','" + lixNam + "']";
     }
     if ((returnValue.length() > 0) && (returnValue.charAt(0) == ',')) {
       returnValue = returnValue.substring(1);
       returnValue = "array=[" + returnValue + "]";
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return returnValue;
 }
Ejemplo n.º 5
0
  private void initTBRTable(DataDom dataDom, String prjNo, Database db) throws Exception {
    String sql1 = "select PRJL_NO from YXPRJLIN where PRJ_NO = " + prjNo;
    String unit = getMonUnit(prjNo);
    Rowset rs = db.getRS(sql1);
    CommSequence seq = CommSequence.getInstance("YXDBJYLIN_SEQ");

    while (rs.next()) {
      String prjlNo = Charset.nullToEmpty(rs.getString("PRJL_NO"));
      String sql =
          "insert into YXDBJYLIN(DBJYL_NO,PRJL_NO,PRJ_NO,IS_NTC,IS_RCV,MON_UNIT)values("
              + seq.getNextValue()
              + ","
              + prjlNo
              + ","
              + Charset.nullToEmpty(prjNo)
              + ","
              + "'N', 'N',"
              + unit
              + ")";
      db.execSqlUpdate(sql);
    }
  }
Ejemplo n.º 6
0
  private void initNoSplitTbrTab(DataDom dataDom, String prjNo, Database db) throws Exception {
    String sql =
        "select t.TBR_NAM,t.TBR_NO,d.PRJL_NO from  YXTBRMST t join YXBJDFLIN d  on t.TBR_NO=d.TBR_NO  where d.PRJ_NO = "
            + prjNo;
    Rowset rs = db.getRS(sql);

    Table ct1 = dataDom.getTable("YXDBJYLIN");
    Row row = new Row(false, 0, 0, "new");
    row.addColumn("PRJ_NO", Charset.nullToEmpty(prjNo));
    String unit = getMonUnit(prjNo);
    row.addColumn("IS_NTC", "N");
    row.addColumn("IS_RCV", "N");
    row.addColumn("MON_UNIT", unit);
    if (rs.next()) {
      row.addColumn("PRJL_NO", Charset.nullToEmpty(rs.getString("PRJL_NO")));
      row.addColumn("TBR_NO", rs.getString("TBR_NO"));
      ct1.getRows().put("0", row);
      creatSel(ct1.getField("TBR_NO"), sql, false, false);
    } else {
      ct1.clearRow();
    }
  }
Ejemplo n.º 7
0
 /**
  * ??????????????л?????λ
  *
  * @param prj_no
  * @return
  * @addTime 2014-2-25 ????10:47:13
  * @author Libo
  */
 private String getMonUnit(String prj_no) {
   String unit = "";
   try {
     Rowset rs =
         Database.getRowset("SELECT MON_UNIT FROM YXKBRMST WHERE PRJ_NO = '" + prj_no + "'");
     if (rs.next()) {
       unit = Charset.nullToEmpty(rs.getString(1));
     }
   } catch (Exception e) {
     Log.error(e);
   }
   return unit;
 }
Ejemplo n.º 8
0
  public void USR_ID_onblur(
      DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {

    String usrId = "";
    String usrNam = "";

    try {

      usrId = Charset.nullToEmpty(serviceRequest.getParameter("value"));
      if (!usrId.equals("")) {
        usrNam = Charset.nullToEmpty(UTUSRMST.getDesc(usrId));
        if (usrNam.equals("")) {
          serviceRequest.addServiceReturnParameter("USRFLG", "FALSE");
          return;
        }
      }
      serviceRequest.addServiceReturnParameter("USRFLG", "TRUE");
      serviceRequest.addServiceReturnParameter("USR_ID", usrId);
      serviceRequest.addServiceReturnParameter("USR_NAM", usrNam);
    } catch (Exception e) {
      Log.error(e);
    }
  }
Ejemplo n.º 9
0
  public void TabOnClick(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {
    Table table = dataDom.getTable("YXDBJYMST");
    if (table != null) {
      Field orgNoField = table.getField("ORG_NO");
      if (orgNoField != null) {
        Row currRow = table.getRow(0L);
        String orgNo = "";

        if (currRow != null) {
          orgNo = Charset.nullToEmpty(currRow.getColumnValue("ORG_NO"));
        }
        if (!("".equals(orgNo))) serviceRequest.addParameter("selectorgno", orgNo);
        else serviceRequest.addParameter("selectorgno", sessionInfo.getOrg()[0].getValue());
      } else {
        serviceRequest.addParameter("selectorgno", sessionInfo.getOrg()[0].getValue());
      }
    } else {
      serviceRequest.addParameter("selectorgno", sessionInfo.getOrg()[0].getValue());
    }
    super.TabOnClick(dataDom, sessionInfo, serviceRequest);
  }
Ejemplo n.º 10
0
 /**
  * 程序初始化方法 @Override
  *
  * @param dataDom DataDom
  * @param sessionInfo SessionInfo
  * @param serviceRequest ServiceRequest
  */
 public void init(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) {
   super.init(dataDom, sessionInfo, serviceRequest);
   Select usr_id = dataDom.getExtend().getSelect("EXT_USR_ID");
   String sql =
       "select distinct a.usr_nam,a.usr_id,a.mop_no from utusrmst a, utusremplnk b, cmempmst c,(select aa.emp_no, aa.position_no from cmempposmst aa,(select emp_no, max(nvl(regular_flg, 0)) flag from cmempposmst group by emp_no) bb where aa.emp_no = bb.emp_no and nvl(aa.regular_flg, 0) = bb.flag) d,cmpositionmst e,ogcstposmst f,ogcstmst g,carinfmst h where a.usr_id = b.usr_id and b.emp_no = c.emp_no and c.emp_no = d.emp_no and d.position_no = e.position_no and e.position_no = f.position_no and f.cst_no = g.cst_no and g.cst_no = 1 and g.cst_id = 'GSLD' and g.cst_nam = '公司领导' and c.valid_sta = 'A' and a.usr_id = h.carinf_usr_id order by a.mop_no";
   creatSel(usr_id, sql, false);
   String paraTo = Charset.nullToEmpty(serviceRequest.getParameter("paraTo"));
   if (paraTo != null && !"".equals(paraTo)) {
     String[] param = paraTo.split(",", 2);
     serviceRequest
         .getMessage()
         .addJS("document.getElementById('Data_Dtm').value='" + param[0] + "';");
     dataDom.getExtend().getSelect("EXT_USR_ID").setSelectedValueList(param[1]);
   } else {
     Calendar curCal = Calendar.getInstance();
     curCal.add(5, 0);
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
     String dateStr = sdf.format(curCal.getTime());
     String beg_dtm = dateStr.substring(0, 4);
     dataDom.getExtend().getText("Data_Dtm").setValue(beg_dtm);
   }
 }
Ejemplo n.º 11
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);
  }