public void clearDLFL_AMT(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) throws Exception { Table table = dataDom.getTable("YXPRJMST"); Database db = null; String pk = ""; try { db = Tools.getDatabase(false); save(dataDom, sessionInfo, serviceRequest); serviceRequest.getMessage().clear(); pk = table.getPkValue(); db.execSqlUpdate("update YXPRJLIN set DLFL_AMT='' where PRJ_NO = " + pk); db.commit(); pk = table.getPkValue(); WhereLimit wr = new WhereLimit(); wr.addColumn(new Column("PRJ_NO", pk)); dataDom.getTable("YXPRJLIN").setWhereLimit(wr); dataDom.getTable("YXPRJLIN").refresh("B1YXM00030", sessionInfo); } catch (Exception ex) { db.rollback(); Log.error(ex); } finally { if (db != null) { db.cleanup(); } } }
public void DeleteAllSubTable_FB( DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) throws Exception { Table table = dataDom.getTable("YXPRJMST"); Database db = null; String pk = ""; try { db = Tools.getDatabase(false); save(dataDom, sessionInfo, serviceRequest); serviceRequest.getMessage().clear(); pk = table.getPkValue(); if ((pk != null) && (!"".equals(pk))) { db.execSqlUpdate("delete from YXPRJLIN where IS_FB='Y' and PRJ_NO = " + pk); } db.commit(); WhereLimit wr = new WhereLimit(); wr.addColumn(new Column("PRJ_NO", pk)); dataDom.getTable("YXPRJLIN").setWhereLimit(wr); dataDom.getTable("YXPRJLIN").refresh("B1YXM00030", sessionInfo); } catch (Exception ex) { if (db != null) { db.rollback(); } Log.error(ex); } finally { if (db != null) { db.cleanup(); } } }
public void Delete(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) { Table table = dataDom.getTable("YXDBJYMST"); Row row = table.getRow(0L); if (row == null) { serviceRequest.getMessage().addInfo("没有需要删除的数据"); return; } String pkValue = table.getPkValue(); if ((pkValue == null) || ("".equals(pkValue.trim()))) { serviceRequest.getMessage().addInfo("没有需要删除的数据"); return; } Database db = null; try { db = Tools.getDatabase(false); deleteChildTable(dataDom, sessionInfo, serviceRequest, db); super.Delete(dataDom, sessionInfo, serviceRequest, db); db.commit(); dataDom.refresh(sessionInfo); serviceRequest.getMessage().addInfo("删除数据成功"); } catch (Exception e) { if (db != null) { db.rollback(); } Log.error(e); serviceRequest.getMessage().addInfo("发生异常,请联系管理员"); } finally { if (db != null) { db.cleanup(); } dataDom.refresh(sessionInfo); } init(dataDom, sessionInfo, serviceRequest); }
public void Delete(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) { Table table = dataDom.getTable("YXPBPFMST"); Row row = table.getRow(0L); if (row == null) { /* */ serviceRequest.getMessage().addInfo("没有需要删除的数据!"); return; } String pkValue = table.getPkValue(); if ((pkValue == null) || ("".equals(pkValue.trim()))) { serviceRequest.getMessage().addInfo("没有需要删除的数据!"); return; } Database db = null; try { db = Tools.getDatabase(false); deleteChildTable(dataDom, sessionInfo, serviceRequest, db); super.Delete(dataDom, sessionInfo, serviceRequest, db); db.commit(); serviceRequest.getMessage().addInfo("删除成功!"); } catch (Exception e) { if (db != null) { db.rollback(); } Log.error(e); serviceRequest.getMessage().addInfo("删除失败,请重试或联系系统管理员!"); } finally { if (db != null) db.cleanup(); } }
public void Delete(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) { Table table = dataDom.getTable("YXPRJMST"); Row row = table.getRow(0L); if (row == null) { serviceRequest.getMessage().addInfo("没有需要删除的数据!"); return; } String pkValue = table.getPkValue(); if ((pkValue == null) || ("".equals(pkValue.trim()))) { serviceRequest.getMessage().addInfo("没有需要删除的数据!"); return; } Database db = null; try { db = Tools.getDatabase(false); deleteChildTable(dataDom, sessionInfo, serviceRequest, db); super.Delete(dataDom, sessionInfo, serviceRequest, db); db.commit(); String pk = table.getPkValue(); table.refreshG(pk); pk = table.getPkValue(); WhereLimit wl = new WhereLimit(); wl.addColumn("new_sql_wherelimit", "PRJ_NO =" + pk); Log.info("PRJ_NO:" + pk); dataDom.getTable("YXPRJLIN").setWhereLimit(wl); dataDom.getTable("YXPRJLIN").refresh2("B1YXM00030", sessionInfo); } catch (Exception e) { if (db != null) { db.rollback(); } Log.error(e); serviceRequest.getMessage().addInfo("删除失败,请重试或联系系统管理员!"); table.refresh("B1YXM00030", sessionInfo); ; } finally { if (db != null) { db.cleanup(); } } }
public void DeleteAllSubTable( DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) throws Exception { Table table = dataDom.getTable("YXPRJMST"); Database db = null; String pk = ""; try { db = Tools.getDatabase(false); save(dataDom, sessionInfo, serviceRequest); serviceRequest.getMessage().clear(); pk = table.getPkValue(); db.execSqlUpdate("delete from YXPRJLIN where PRJ_NO = " + pk); db.commit(); } catch (Exception ex) { db.rollback(); Log.error(ex); } finally { if (db != null) { db.cleanup(); } } setFirstRowSubTable(dataDom, sessionInfo, serviceRequest); }
public void setFirstRowSubTable( DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) throws Exception { String ZB_ID = serviceRequest.getParameter("ZB_ID"); String PRJ_NAM = serviceRequest.getParameter("PRJ_NAM"); Table table = dataDom.getTable("YXPRJMST"); Database db = null; String pk = ""; try { db = Tools.getDatabase(false); pk = table.getPkValue(); String nextPkValue = CommSequence.getInstance("YXPRJLIN_SEQ").getNextValue(); db.execSqlUpdate( "insert into YXPRJLIN(PRJL_NO,PRJ_NO,PRJL_ID,PRJL_NAM,IS_FB) values( " + nextPkValue + "," + pk + ",'" + ZB_ID + "','" + PRJ_NAM + "','Y') "); db.commit(); pk = table.getPkValue(); WhereLimit wr = new WhereLimit(); wr.addColumn(new Column("PRJ_NO", pk)); dataDom.getTable("YXPRJLIN").setWhereLimit(wr); dataDom.getTable("YXPRJLIN").refresh("B1YXM00030", sessionInfo); } catch (Exception ex) { db.rollback(); Log.error(ex); } finally { if (db != null) { db.cleanup(); } } }
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(); } } }
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); }