📄 cexsheetadapter.java
字号:
package net.intuitsoft.xeon.table.sale.ex;import intuitsoft.eclipse.table.common.DatabaseConnection;import intuitsoft.eclipse.table.common.DocPrefix;import intuitsoft.eclipse.table.common.FormatBillCode;import intuitsoft.eclipse.table.common.WriteLog;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.util.LinkedList;import java.util.List;/** * <p> * Title: 零售连锁管理系统 * </p> * <p> * Description: 零售业最佳应用 * </p> * <p> * Copyright: Copyright (c) 1999 - 2004 * </p> * <p> * Company: 直觉软件科技 * </p> * * @author: KENT * @version 1.0 Since 2004-03-22 04-10 */public class CExSheetAdapter extends ExSheetBean implements ExSheetAdapter { public CExSheetAdapter(String jndi) { super(jndi); } private double discount1 = 0; private double discount3 = 0; public double getDiscount1() { return this.discount1; } public void setDiscount1(String sV) { if (sV != null && !"".equals(sV)) { this.discount1 = Double.parseDouble(sV); } } public void setDiscount1(double nV) { this.discount1 = nV; } public double getDiscount3() { return this.discount3; } public void setDiscount3(String sV) { if (sV != null && !"".equals(sV)) { this.discount3 = Double.parseDouble(sV); } } public void setDiscount3(double nV) { this.discount3 = nV; } private String linkman = ""; public String getLinkman() { return this.linkman; } public void setLinkman(String sV) { if (sV != null) { this.linkman = sV; } } private String subNo = ""; private String subName = ""; public String getSubNo() { return this.subNo; } public void setSubNo(String sV) { if (sV != null) { this.subNo = sV; } } public String getSubName() { return this.subName; } public void setSubName(String sV) { if (sV != null) { this.subName = sV; } } private double shortAmo = 0; private double prevShortAmo = 0; public double getPrevShortAmo() { return this.prevShortAmo; } public void setPrevShortAmo(String sV) { if (sV != null && !"".equals(sV)) { this.prevShortAmo = Double.parseDouble(sV); } } public void setPrevShortAmo(double fV) { this.prevShortAmo = fV; } public double getShortAmo() { return this.shortAmo; } public void setShortAmo(String sV) { if (sV != null && !"".equals(sV)) { this.shortAmo = Double.parseDouble(sV); } } public void setShortAmo(double fV) { this.shortAmo = fV; } private String emplName = ""; String createDate1 = ""; String createDate3 = ""; String regionID = ""; private String custName = ""; private String custNo = ""; private String warehouseName = ""; private String brandName = ""; private String settMode = ""; private String address = ""; private String tel = ""; int stat = 0; private int exItemsID = 0; private int goodsID = 0; private String code = ""; private String classID = ""; public int getGoodsID() { return this.goodsID; } public void setGoodsID(String sV) { if (sV != null && !"".equals(sV)) { this.goodsID = Integer.parseInt(sV); } } public void setGoodsID(int nV) { this.goodsID = nV; } public int getExItemsID() { return this.exItemsID; } public void setExItemsID(String sV) { if (sV != null && !"".equals(sV)) { this.exItemsID = Integer.parseInt(sV); } } public void setExItemsID(int nV) { this.exItemsID = nV; } public void setCode(String code) { if (code != null) { this.code = code; } } public String getCode() { return this.code; } public void setRegionID(String code) { if (code != null) { this.regionID = code; } } public String getRegionID() { return this.regionID; } public String getClassID() { return this.classID; } public void setClassID(String sV) { if (sV != null) { this.classID = sV; } } public int getStat() { return this.stat; } public void setStat(String sV) { if (sV != null && !"".equals(sV)) { this.stat = Integer.parseInt(sV); } } public void setStat(int nV) { this.stat = nV; } public String getBrandName() { return this.brandName; } public void setBrandName(String sV) { if (sV != null) { this.brandName = sV; } } public String getWarehouseName() { return this.warehouseName; } public void setWarehouseName(String sV) { if (sV != null) { this.warehouseName = sV; } } public String getEmplName() { return this.emplName; } public void setEmplName(String sV) { if (sV != null) { this.emplName = sV; } } public String getCustName() { return this.custName; } public void setCustName(String sV) { if (sV != null) { this.custName = sV; } } public String getCustNo() { return this.custNo; } public void setCustNo(String sV) { if (sV != null) { this.custNo = sV; } } public String getSettMode() { return this.settMode; } public void setSettMode(String sV) { if (sV != null) { this.settMode = sV; } } public String getAddress() { return this.address; } public void setAddress(String sV) { if (sV != null) { this.address = sV; } } public String getTel() { return this.tel; } public void setTel(String sV) { if (sV != null) { this.tel = sV; } } public String getCreateDate1() { return this.createDate1; } public String getCreateDate3() { return this.createDate3; } public void setCreateDate1(String sV) { if (sV != null) { this.createDate1 = sV.substring(0, (sV.length() > 10) ? 10 : sV .length()); } } public void setCreateDate3(String sV) { if (sV != null) { this.createDate3 = sV.substring(0, (sV.length() > 10) ? 10 : sV .length()); } } private String getMaxCode() { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { try { DatabaseConnection dc = new DatabaseConnection(getJndiName()); conn = dc.getConnection(); String sql = "select max(exSheetCode) as code from exSheet where exSheetCode like '" + FormatBillCode .dateConversionToCodeStyle(DocPrefix.EX_SHEET) + "%'"; stmt = conn.prepareStatement(sql); rs = stmt.executeQuery(); if (rs.next()) { String s1 = rs.getString("code"); return s1; } String s2 = null; return s2; } catch (Exception ex) { ex.printStackTrace(); } String s = null; return s; } finally { try { if (rs != null) { rs.close(); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (Exception ex) { ex.printStackTrace(); } } } public String newExSheetCode() { int step = 1; String code = getMaxCode(); String prefix = FormatBillCode .dateConversionToCodeStyle(DocPrefix.EX_SHEET); if (code == null || "".equals(code)) { return String.valueOf(String.valueOf(prefix)).concat("001"); } if (code.startsWith(prefix)) { return String.valueOf(prefix) + String.valueOf(FormatBillCode.fill(3, Integer .parseInt(code.substring(prefix.length())) + step)); } else { return String.valueOf(String.valueOf(prefix)).concat("001"); } } public boolean updateStatus(String exSheetCode, boolean isExt, boolean isExtAcc, double payAmo) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { DatabaseConnection dc = new DatabaseConnection(getJndiName()); conn = dc.getConnection(); String sql = "update exSheet set isExt=?,isExtAcc=?,payAmo=payAmo+?,accDate=getDate() where exSheetCode=?"; pstmt = conn.prepareStatement(sql); pstmt.setBoolean(1, isExt); pstmt.setBoolean(2, isExtAcc); pstmt.setDouble(3, payAmo); pstmt.setString(4, exSheetCode); pstmt.execute(); return true; } catch (Exception ex) { ex.printStackTrace(); new WriteLog(getJndiName(), 0, 10000, "core", "database", "kernel", this.getClass().getName() + ": " + ex.getMessage(), true, 0); ex.printStackTrace(); return false; } finally { try { if (rs != null) { rs.close(); } if (pstmt != null) { pstmt.close(); } if (conn != null) { conn.close(); } } catch (Exception ex) { ex.printStackTrace(); } } } public List getExSheets(int custID) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; List list = null; try { DatabaseConnection dc = new DatabaseConnection(getJndiName()); conn = dc.getConnection(); list = new LinkedList(); String sql = "select * from exSheet where custID=? and isExtAcc=0 and isAcc=1 and isRegLed=1 "; pstmt = conn.prepareStatement(sql); pstmt.setInt(1, custID); rs = pstmt.executeQuery(); while (rs.next()) { setExSheetCode(rs.getString("exSheetCode")); setCreateDate(rs.getString("createDate")); setAmo(rs.getDouble("amo")); list.add(super.clone()); } return list; } catch (Exception ex) { ex.printStackTrace(); new WriteLog(getJndiName(), 0, 10000, "core", "kernel", "database", this.getClass().getName() + ": " + ex.getMessage(), true, 0); return list; } finally { try { if (rs != null) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -