/** * 初始化函数 * * @throws Exception 异常信息 */ protected void jbInit() throws Exception { setDataSetProperty(dsBatchAddTable, KHCPZK_STRUCT_SQL); dsBatchAddTable.setTableName("xs_khcpzk"); dsxs_khcpzkTable.setTableName("xs_khcpzk"); // String SQL = combineSQL(CUSTOMER_PRODUCT_DISCOUNT_SQL, "?", new // String[]{fgsid,user.getHandleDeptValue(),""}); setDataSetProperty(dsxs_khcpzkTable, null); // dsxs_khcpzkTable.setSort(new SortDescriptor("", new String[]{"dwtxId","cpId"}, new // boolean[]{false,false}, null, 0)); // dsxs_khcpzkTable.setSequence(new SequenceDescriptor(new String[]{"cpId","dwtxId"}, new // String[]{"s_xs_khcpzk","s_xs_khcpzk"})); // 添加操作的触发对象 dsBatchAddTable.addLoadListener( new com.borland.dx.dataset.LoadListener() { public void dataLoaded(LoadEvent e) { initRowInfo(false, true); } }); B_CustomerProductDiscount_Add_Edit add_edit = new B_CustomerProductDiscount_Add_Edit(); addObactioner(String.valueOf(INIT), new B_CustomerProductDiscount_Init()); addObactioner(String.valueOf(ADD), add_edit); addObactioner(String.valueOf(EDIT), add_edit); addObactioner(String.valueOf(POST), new B_CustomerProductDiscount_Post()); addObactioner(String.valueOf(DEL), new B_CustomerProductDiscount_Delete()); addObactioner(String.valueOf(FIXED_SEARCH), new FIXED_SEARCH()); addObactioner(String.valueOf(BATCHADD), new Batch_Add()); addObactioner(String.valueOf(BATCHPOST), new Batch_Post()); addObactioner(String.valueOf(BATCHINIT), new Batch_Add_Init()); }
/** * 初始化行信息 * * @param isAdd 是否时添加 * @param isInit 是否从新初始化 */ private final void initRowInfo(boolean isAdd, boolean isInit) { if (d_RowInfos == null) d_RowInfos = new ArrayList(dsBatchAddTable.getRowCount()); else if (isInit) d_RowInfos.clear(); dsBatchAddTable.first(); for (int i = 0; i < dsBatchAddTable.getRowCount(); i++) { RowMap row = new RowMap(dsBatchAddTable); d_RowInfos.add(row); dsBatchAddTable.next(); } }
public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { EngineDataSet ds = getOneTable(); rowInfo.put(data.getRequest()); String cpid = rowInfo.get("cpid"); String zk = rowInfo.get("zk"); String bz = rowInfo.get("bz"); String dwtxid = rowInfo.get("dwtxid"); String djlx = rowInfo.get("djlx"); if (!isAdd) ds.goToInternalRow(editrow); if (isAdd) { String count = dataSetProvider.getSequence( "SELECT count(*) FROM xs_khcpzk where fgsid=" + fgsid + " and dwtxid=" + dwtxid + " and cpid=" + cpid); if (count != null && !count.equals("0")) { data.setMessage(showJavaScript("alert('已有该产品!')")); return; } ds.insertRow(false); ds.setValue("fgsid", fgsid); } ds.setValue("djlx", djlx); ds.setValue("cpid", cpid); ds.setValue("dwtxId", dwtxid); ds.setValue("zk", zk); ds.setValue("bz", bz); ds.post(); ds.saveChanges(); data.setMessage(showJavaScript("parent.hideInterFrame();")); }
/*打开从表*/ public final void openDetailTable(boolean isMasterAdd) { htid = dsMasterTable.getValue("htid"); // 关链 // isMasterAdd为真是返回空的从表数据集(主表新增时,从表要打开) dsDetailTable.setQueryString( DETAIL_SQL + (isMasterAdd ? "-1" : ("'" + htid + "' and (storeid is null or storeid='" + storeid + "')"))); if (dsDetailTable.isOpen()) dsDetailTable.refresh(); else dsDetailTable.open(); }
/** * JSP调用的函数 * * @param request 网页的请求对象 * @param response 网页的响应对象 * @return 返回HTML或javascipt的语句 * @throws Exception 异常 */ public String doService(HttpServletRequest request, HttpServletResponse response) { try { String opearate = request.getParameter(OPERATE_KEY); if (opearate != null && opearate.trim().length() > 0) { RunData data = notifyObactioners(opearate, request, response, null); if (data.hasMessage()) return data.getMessage(); } return ""; } catch (Exception ex) { if (dsxs_khcpzkTable.isOpen() && dsxs_khcpzkTable.changesPending()) dsxs_khcpzkTable.reset(); log.error("doService", ex); return showMessage(ex.getMessage(), true); } }
/** * 初始化查询的各个列 * * @param request web请求对象 */ private void initQueryItem(HttpServletRequest request) { if (isInitQuery) return; EngineDataSet master = dsXsTable; // 初始化固定的查询项目 // 往来单位dwtxId;信誉额度xyed;信誉等级xydj;回款天数hkts; fixedQuery.addShowColumn( "", new QueryColumn[] { new QueryColumn(master.getColumn("dwtxid"), null, null, null, null, "="), new QueryColumn(master.getColumn("nf"), null, null, null, null, "="), new QueryColumn(master.getColumn("yf"), null, null, null, null, "=") }); isInitQuery = true; }
/** session失效时调用 */ public void valueUnbound(HttpSessionBindingEvent event) { if (dsSaleOrderProduct != null) { dsSaleOrderProduct.close(); dsSaleOrderProduct = null; } log = null; }
/** * 初始化列信息 * * @param isAdd 是否时添加 * @param isInit 是否从新初始化 * @throws java.lang.Exception 异常 */ private final void initRowInfo(boolean isMaster, boolean isAdd, boolean isInit) throws java.lang.Exception { // 是否是主表 if (isMaster) { if (isInit && m_RowInfo.size() > 0) m_RowInfo.clear(); // 清除旧数据 if (!isAdd) m_RowInfo.put(getMaterTable()); // 不是新增时,推入主表当前行 } else { EngineDataSet dsDetail = dsDetailTable; if (d_RowInfos == null) d_RowInfos = new ArrayList(dsDetail.getRowCount()); else if (isInit) d_RowInfos.clear(); dsDetail.first(); for (int i = 0; i < dsDetail.getRowCount(); i++) { RowMap row = new RowMap(dsDetail); d_RowInfos.add(row); dsDetail.next(); } } }
/** jvm要调的函数,类似于析构函数 */ public void valueUnbound(HttpSessionBindingEvent event) { if (dsxs_khcpzkTable != null) { dsxs_khcpzkTable.close(); dsxs_khcpzkTable = null; } log = null; rowInfo = null; locateRow = null; }
/** Session失效时,调用的函数 */ public final void valueUnbound(HttpSessionBindingEvent event) { if (dsMasterTable != null) { dsMasterTable.close(); dsMasterTable = null; } if (dsDetailTable != null) { dsDetailTable.close(); dsDetailTable = null; } log = null; m_RowInfo = null; d_RowInfos = null; if (masterProducer != null) { masterProducer.release(); masterProducer = null; } if (detailProducer != null) { detailProducer.release(); detailProducer = null; } deleteObservers(); }
/** * @param request 网页的请求对象 * @param response 网页的响应对象 * @return 返回HTML或javascipt的语句 * @throws Exception 异常 */ private final void putDetailInfo(HttpServletRequest request) { RowMap rowInfo = new RowMap(); rowInfo.put(request); int rownum = dsBatchAddTable.getRowCount(); RowMap detailRow = null; for (int i = 0; i < rownum; i++) { detailRow = (RowMap) d_RowInfos.get(i); detailRow.put("cpid", rowInfo.get("cpid_" + i)); // detailRow.put("djlx", rowInfo.get("djlx_" + i)); // String bz = rowInfo.get("bz_" + i); detailRow.put("bz", rowInfo.get("bz_" + i)); // d_RowInfos.set(i, detailRow); } }
/** * 初始化函数 * * @throws Exception 异常信息 */ private final void jbInit() throws java.lang.Exception { setDataSetProperty(dsMasterTable, MASTER_STRUT_SQL); setDataSetProperty(dsDetailTable, DETAIL_STRUT_SQL); dsMasterTable.setSequence( new SequenceDescriptor( new String[] {"htbh"}, new String[] {"SELECT pck_base.billNextCode('xs_ht','htbh') FROM dual"})); dsMasterTable.setSort( new SortDescriptor("", new String[] {"htbh"}, new boolean[] {true}, null, 0)); dsDetailTable.setSequence( new SequenceDescriptor(new String[] {"hthwid"}, new String[] {"s_xs_hthw"})); Master_Add_Edit masterAddEdit = new Master_Add_Edit(); addObactioner(String.valueOf(INIT), new Init()); addObactioner(String.valueOf(FIXED_SEARCH), new Master_Search()); addObactioner(SHOW_DETAIL, new ShowDetail()); addObactioner(String.valueOf(ADD), masterAddEdit); addObactioner(String.valueOf(EDIT), masterAddEdit); storeid = "-1"; dwtxid = "-1"; }
/** jvm要调的函数,类似于析构函数 */ public void valueUnbound(HttpSessionBindingEvent event) { if (dsXsTable != null) { dsXsTable.close(); dsXsTable = null; } if (dsJsTable != null) { dsJsTable.close(); dsJsTable = null; } if (dsThTable != null) { dsThTable.close(); dsThTable = null; } if (dsQtTable != null) { dsQtTable.close(); dsQtTable = null; } d_XsInfos = null; // 多行记录的引用 d_JsInfos = null; d_ThInfos = null; d_QtInfos = null; log = null; }
/** * 初始化查询的各个列 * * @param request web请求对象 */ private void initQueryItem(HttpServletRequest request) { if (isInitQuery) return; EngineDataSet master = dsSaleOrderProduct; // EngineDataSet detail = dsDetailTable; if (!master.isOpen()) master.open(); // 初始化固定的查询项目 fixedQuery = new QueryFixedItem(); fixedQuery.addShowColumn( "", new QueryColumn[] { new QueryColumn(master.getColumn("tdbh"), null, null, null, null, "="), // 提单编号 new QueryColumn(master.getColumn("dwtxid"), null, null, null, null, "="), // 购货单位 new QueryColumn(master.getColumn("tdrq"), null, null, null, "a", ">="), // 提单日期 new QueryColumn(master.getColumn("tdrq"), null, null, null, "b", "<="), // 提单日期 new QueryColumn(master.getColumn("deptid"), null, null, null, null, "="), // 部门id new QueryColumn(master.getColumn("djlx"), null, null, null, null, "=") // 单据类型 }); isInitQuery = true; }
/** * 初始化查询的各个列 * * @param request web请求对象 */ private void initQueryItem(HttpServletRequest request) { if (isInitQuery) return; // 已初始化查询条件 EngineDataSet master = dsMasterTable; if (!master.isOpen()) master.open(); // 打开主表数据集 // 初始化固定的查询项目 fixedQuery = new QueryFixedItem(); fixedQuery.addShowColumn( "", new QueryColumn[] { new QueryColumn(master.getColumn("htbh"), null, null, null), new QueryColumn(master.getColumn("htrq"), null, null, null, "a", ">="), new QueryColumn(master.getColumn("htrq"), null, null, null, "b", "<="), new QueryColumn(master.getColumn("ksrq"), null, null, null, "a", ">="), new QueryColumn(master.getColumn("ksrq"), null, null, null, "b", "<="), new QueryColumn(master.getColumn("jsrq"), null, null, null, "a", ">="), new QueryColumn(master.getColumn("jsrq"), null, null, null, "b", "<="), new QueryColumn(master.getColumn("dwtxid"), null, null, null, null, "="), }); isInitQuery = true; // 初始化完成 }
/** * 初始化查询的各个列 * * @param request web请求对象 */ private void initQueryItem(HttpServletRequest request) { if (isInitQuery) return; EngineDataSet master = dsxs_khcpzkTable; if (!master.isOpen()) master.open(); // 初始化固定的查询项目 fixedQuery.addShowColumn( "", new QueryColumn[] { new QueryColumn(master.getColumn("dwtxid"), null, null, null, null, "="), new QueryColumn(master.getColumn("cpid"), null, null, null, null, "="), new QueryColumn(master.getColumn("zk"), null, null, null, "a", ">="), new QueryColumn(master.getColumn("zk"), null, null, null, "b", "<=") }); isInitQuery = true; }
public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { initQueryItem(data.getRequest()); fixedQuery.setSearchValue(data.getRequest()); String SQL = fixedQuery.getWhereQuery(); // 得到WHERE子句 if (SQL.length() > 0) SQL = " AND " + SQL; SQL = SQL + " AND (storeid='" + storeid + "' or storeid is null) "; if (!personid.equals("")) SQL = SQL + " AND personid='" + personid + "'"; if (!khlx.equals("")) SQL = SQL + " AND khlx='" + khlx + "'"; if (!dwtxid.equals("")) SQL = SQL + " AND dwtxid='" + dwtxid + "'"; if (!jsfsid.equals("")) SQL = SQL + " AND jsfsid='" + jsfsid + "'"; EngineDataSet tmp = new EngineDataSet(); SQL = combineSQL( HTHW_SQL, "?", new String[] {user.getHandleDeptWhereValue("deptid", "czyid"), fgsid, SQL}); setDataSetProperty(tmp, SQL); tmp.open(); StringBuffer buf = null; ArrayList contain = new ArrayList(); tmp.first(); for (int i = 0; i < tmp.getRowCount(); i++) { String htid = tmp.getValue("htid"); if (!contain.contains(htid)) { contain.add(htid); if (buf == null) buf = new StringBuffer("AND htid IN(").append(htid); else buf.append(",").append(htid); } tmp.next(); } if (buf == null) buf = new StringBuffer(); else buf.append(")"); SQL = buf.toString(); if (SQL.equals("")) SQL = " and 1<>1 "; SQL = combineSQL(MASTER_SQL, "?", new String[] {SQL}); if (!dsMasterTable.getQueryString().equals(SQL)) { dsMasterTable.setQueryString(SQL); dsMasterTable.setRowMax(null); // 以便dbNavigator刷新数据集 } openDetailTable(true); }
public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { retuUrl = data.getParameter("src"); retuUrl = retuUrl != null ? retuUrl.trim() : retuUrl; HttpServletRequest request = data.getRequest(); storeid = request.getParameter("storeid"); // 必选 sendmodeid = request.getParameter("sendmodeid"); // djlx = request.getParameter("djlx"); // khlx = request.getParameter("khlx"); // 非必选 dwtxid = request.getParameter("dwtxid"); // 非必选 personid = request.getParameter("personid"); // 非必选 jsfsid = request.getParameter("jsfsid"); // 非必选 yfdj = request.getParameter("yfdj"); // if (storeid.equals("")) return; String SQL = " AND (storeid='" + storeid + "' or storeid is null) "; if (!khlx.equals("")) SQL = SQL + " AND khlx='" + khlx + "' "; if (!dwtxid.equals("")) SQL = SQL + " AND dwtxid='" + dwtxid + "' "; if (!personid.equals("")) SQL = SQL + " AND personid='" + personid + "' "; if (!jsfsid.equals("")) SQL = SQL + " AND jsfsid='" + jsfsid + "' "; if (!sendmodeid.equals("")) SQL = SQL + " AND sendmodeid='" + sendmodeid + "' "; if (!yfdj.equals("")) SQL = SQL + " AND yfdj='" + yfdj + "' "; srcFrm = request.getParameter("srcFrm"); multiIdInput = request.getParameter("srcVar"); // if(storeid.equals("")||djlx.equals("")||dwtxid.equals("")||personid.equals("")||khlx.equals("")) // return; masterProducer.init(request, loginId); detailProducer.init(request, loginId); // 初始化查询项目和内容 RowMap row = fixedQuery.getSearchRow(); row.clear(); String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); String startDay = new SimpleDateFormat("yyyy-MM-01").format(new Date()); row.put("htrq$a", startDay); row.put("htrq$b", today); row.put("zt", "0"); isMasterAdd = true; EngineDataSet tmp = new EngineDataSet(); SQL = combineSQL( HTHW_SQL, "?", new String[] {user.getHandleDeptWhereValue("deptid", "czyid"), fgsid, SQL}); setDataSetProperty(tmp, SQL); tmp.open(); StringBuffer buf = null; ArrayList contain = new ArrayList(); tmp.first(); for (int i = 0; i < tmp.getRowCount(); i++) { String htid = tmp.getValue("htid"); if (!contain.contains(htid)) { contain.add(htid); if (buf == null) buf = new StringBuffer("AND htid IN(").append(htid); else buf.append(",").append(htid); } tmp.next(); } if (buf == null) buf = new StringBuffer(); else buf.append(")"); SQL = buf.toString(); if (SQL.equals("")) SQL = " and 1<>1 "; // String SQL = " AND jsfsid='"+jsfsid+"' AND personid='"+personid+"' AND khlx ='"+khlx+"' // AND dwtxid ='"+dwtxid+"' AND (storeid='"+storeid+"' or storeid is null) "; SQL = combineSQL(MASTER_SQL, "?", new String[] {SQL}); dsMasterTable.setQueryString(SQL); dsMasterTable.setRowMax(null); if (dsDetailTable.isOpen() && dsDetailTable.getRowCount() > 0) dsDetailTable.empty(); }
/** * 得到选中的行的行数 * * @return 若返回-1,表示没有选中的行 */ public final int getSelectedRow() { if (masterRow < 0) return -1; dsMasterTable.goToInternalRow(masterRow); return dsMasterTable.getRow(); }
/*得到从表表对象*/ public final EngineDataSet getDetailTable() { if (!dsDetailTable.isOpen()) dsDetailTable.open(); return dsDetailTable; }
public void execute(String action, Obationable o, RunData data, Object arg) throws Exception { EngineDataSet ds = getOneTable(); ds.goToRow(Integer.parseInt(data.getParameter("rownum"))); ds.deleteRow(); ds.saveChanges(); }
/** * 初始化列信息 * * @param isAdd 是否时添加 * @param isInit 是否从新初始化 * @throws java.lang.Exception 异常 */ private final void initRowInfo(boolean isInit) throws java.lang.Exception { /** 本月销售* */ double zxsje = 0; double zjje = 0; if (d_XsInfos == null) d_XsInfos = new ArrayList(dsXsTable.getRowCount()); if (isInit) d_XsInfos.clear(); else { dsXsTable.first(); for (int i = 0; i < dsXsTable.getRowCount(); i++) { RowMap row = new RowMap(dsXsTable); String xsje = dsXsTable.getValue("xsje"); zxsje = zxsje + Double.parseDouble(xsje.equals("") ? "0" : xsje); String jje = dsXsTable.getValue("jje"); zjje = zjje + Double.parseDouble(jje.equals("") ? "0" : jje); d_XsInfos.add(row); dsXsTable.next(); } } /** 本月收款* */ double zjsje = 0; if (d_JsInfos == null) d_JsInfos = new ArrayList(dsJsTable.getRowCount()); if (isInit) d_JsInfos.clear(); else { dsJsTable.first(); for (int i = 0; i < dsJsTable.getRowCount(); i++) { RowMap row = new RowMap(dsJsTable); String je = dsJsTable.getValue("je"); zjsje = zjsje + Double.parseDouble(je.equals("") ? "0" : je); d_JsInfos.add(row); dsJsTable.next(); } } /** 本月退货* */ double zthje = 0; if (d_ThInfos == null) d_ThInfos = new ArrayList(dsThTable.getRowCount()); if (isInit) d_ThInfos.clear(); else { dsXsTable.first(); for (int i = 0; i < dsThTable.getRowCount(); i++) { RowMap row = new RowMap(dsThTable); String tjje = dsThTable.getValue("tjje"); zthje = zthje + Double.parseDouble(tjje.equals("") ? "0" : tjje); d_ThInfos.add(row); dsThTable.next(); } } /** 其他应收款* */ double zfy = 0; if (d_QtInfos == null) d_QtInfos = new ArrayList(dsQtTable.getRowCount()); if (isInit) d_QtInfos.clear(); else { dsQtTable.first(); for (int i = 0; i < dsQtTable.getRowCount(); i++) { RowMap row = new RowMap(dsQtTable); String fy = dsQtTable.getValue("fy"); zfy = zfy + Double.parseDouble(fy.equals("") ? "0" : fy); d_QtInfos.add(row); dsQtTable.next(); } } masterRow.put("zxsje", String.valueOf(zxsje)); masterRow.put("zjje", String.valueOf(zjje)); masterRow.put("zjsje", String.valueOf(zjsje)); masterRow.put("zthje", String.valueOf(zthje)); masterRow.put("zfy", String.valueOf(zfy)); // masterRow.put("zsk",String.valueOf(zjsje+zfy)); }