📄 stockinfo.java
字号:
package com.saas.biz.stockorderMgr;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import com.saas.biz.dao.stockorderDAO.StockorderExt;
import com.saas.biz.propertyuMgr.PropertyuInfo;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
/**
* @author:LiuYang
* @DESC: 求购信息
* @2008-7-8
*/
public class StockInfo {
Dbtable tradeQuery;
Logger log;
Buffers inBuffer;
Buffers outBuffer;
@SuppressWarnings("unchecked")
ArrayList queryResult = new ArrayList();
SimpleDateFormat formate;
public StockInfo() {
log = new Logger(this);
tradeQuery = new Dbtable();
formate = new SimpleDateFormat("yyyy-MM-dd");
}
public void setTradeQuery(Dbtable tradeQuery) {
this.tradeQuery = tradeQuery;
}
public Dbtable getTradeQuery() {
return this.tradeQuery;
}
public void setOutBuffer(Buffers outBuffer) {
this.outBuffer = outBuffer;
}
public Buffers getOutBuffer() {
return this.outBuffer;
}
@SuppressWarnings("unchecked")
public ArrayList getQueryResult() {
return this.queryResult;
}
@SuppressWarnings("unchecked")
public void setQueryResult(ArrayList queryResult) {
this.queryResult = queryResult;
}
/**
* 取出供应信息
*
* @type0供应信息
* @type1最新供应信息
* @info_type信息类型
*/
@SuppressWarnings("unchecked")
public ArrayList getStockInfoList(int iStart, int size, String info_type) throws SaasApplicationException {
ArrayList supplyList = new ArrayList();
PropertyuInfo property = new PropertyuInfo();
// 是否启用审核机制
boolean validity = property.getValidityInfo("106", info_type);
if (validity) {
supplyList = getStockInfoByList(iStart, size);
}
else {
supplyList = getStockInfoByList(iStart, size);
}
return supplyList;
}
/**
* @param iStart
* 启始页
* @param size
* 数量
* @return
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public ArrayList getStockInfoByList(int iStart, int size) throws SaasApplicationException {
if (iStart > 1) {
iStart = (iStart - 1) * size;
}
else {
iStart = 0;
}
StockorderExt stockExt = new StockorderExt();
ArrayList list = stockExt.selByList("SEL_BY_VIEW", iStart, size);
return list;
}
/**
* @return 求购信息总数
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public int getStockInfoByCount() throws SaasApplicationException {
int size = 0;
StockorderExt stockExt = new StockorderExt();
ArrayList list = stockExt.selByList("SEL_BY_VIEW_CT");
if (list != null && list.size() > 0) {
HashMap map = (HashMap) list.get(0);
size = Integer.parseInt(map.get("ct").toString());
}
return size;
}
/**
* @param iStart
* 启始页
* @param size
* 数量
* @return
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public ArrayList getNewStockInfoByList(int iStart, int size) throws SaasApplicationException {
if (iStart > 1) {
iStart = (iStart - 1) * size;
}
else {
iStart = 0;
}
Calendar date = Calendar.getInstance();
String start_date = formate.format(date.getTime());
date.add(Calendar.MONTH, 1);
String end_date = formate.format(date.getTime());
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VSTART_DATE", start_date);
stockExt.setParam(":VEND_DATE", end_date);
ArrayList list = stockExt.selByList("SEL_NEW_BY_VIEW", iStart, size);
return list;
}
/**
* @return 求购信息总数
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public int getNewStockInfoByCount() throws SaasApplicationException {
Calendar date = Calendar.getInstance();
String start_date = formate.format(date.getTime());
date.add(Calendar.MONTH, 1);
String end_date = formate.format(date.getTime());
int size = 0;
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VSTART_DATE", start_date);
stockExt.setParam(":VEND_DATE", end_date);
ArrayList list = stockExt.selByList("SEL_NEW_BY_VIEW_CT");
if (list != null && list.size() > 0) {
HashMap map = (HashMap) list.get(0);
size = Integer.parseInt(map.get("ct").toString());
}
return size;
}
/**
* 取出单个求购信息
*/
@SuppressWarnings("unchecked")
public HashMap getStockInfoById(String stock_id) throws SaasApplicationException {
HashMap map = new HashMap();
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VSTOCK_ID", stock_id);
ArrayList list = stockExt.selByList("SEL_VIEW_BY_ID");
if (list != null && list.size() > 0) {
map = (HashMap) list.get(0);
}
return map;
}
/**
* add By WangY Date:08.07.14
*
* @param iStart
* @param product_name
* @param pro
* @param city
* @param date_scope
* @return 求购查询选了一级分类的
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public ArrayList getProductByStock(int iStart, String stock_key, String pro, String city, String part) throws SaasApplicationException {
log.LOG_INFO("进入getProductByStock方法");
if (iStart > 1) {
iStart = (iStart - 1) * 10;
}
else {
iStart = 0;
}
ArrayList saleList = new ArrayList();
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VSTOCK_KEY", "%" + stock_key + "%");
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VCITY", "%" + city + "%");
stockExt.setParam(":VPART", part);
saleList = stockExt.selByList("SEL_PRODUCT_BY_STOCK", iStart, 10);
log.LOG_INFO("退出getProductByStock方法");
return saleList;
}
@SuppressWarnings("unchecked")
public int getProductByStock(String stock_key, String pro, String city, String part) throws SaasApplicationException {
int size = 0;
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VSTOCK_KEY", "%" + stock_key + "%");
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VCITY", "%" + city + "%");
stockExt.setParam(":VPART", part);
ArrayList list = stockExt.selByList("SEL_PRODUCT_BY_STOCK");
if (list != null && list.size() > 0) {
size = list.size();
}
return size;
}
/**
* NO city
* @param iStart
* @param stock_key
* @param pro
* @param city
* @param part
* @return
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public ArrayList getProductByStockOffCity(int iStart, String stock_key, String pro, String part) throws SaasApplicationException {
log.LOG_INFO("进入getProductByStock方法");
if (iStart > 1) {
iStart = (iStart - 1) * 10;
}
else {
iStart = 0;
}
ArrayList saleList = new ArrayList();
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VSTOCK_KEY", "%" + stock_key + "%");
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VPART", part);
saleList = stockExt.selByList("SEL_PRODUCT_BY_STOCK_CT", iStart, 10);
log.LOG_INFO("退出getProductByStock方法");
return saleList;
}
@SuppressWarnings("unchecked")
public int getProductByStockOffCity(String stock_key, String pro, String part) throws SaasApplicationException {
int size = 0;
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VSTOCK_KEY", "%" + stock_key + "%");
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VPART", part);
ArrayList list = stockExt.selByList("SEL_PRODUCT_BY_STOCK_CT");
if (list != null && list.size() > 0) {
size = list.size();
}
return size;
}
/**
* NO Key City
* @param iStart
* @param pro
* @param part
* @return
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public ArrayList getProductByStockOffKey(int iStart,String pro, String part) throws SaasApplicationException {
log.LOG_INFO("进入getProductByStock方法");
if (iStart > 1) {
iStart = (iStart - 1) * 10;
}
else {
iStart = 0;
}
ArrayList saleList = new ArrayList();
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VPART", part);
saleList = stockExt.selByList("SEL_PRODUCT_BY_NO_KEY", iStart, 10);
log.LOG_INFO("退出getProductByStock方法");
return saleList;
}
@SuppressWarnings("unchecked")
public int getProductByStockOffKey( String pro, String part) throws SaasApplicationException {
int size = 0;
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VPART", part);
ArrayList list = stockExt.selByList("SEL_PRODUCT_BY_NO_KEY");
if (list != null && list.size() > 0) {
size = list.size();
}
return size;
}
/**
* NO key
* @param iStart
* @param pro
* @param city
* @param part
* @return
* @throws SaasApplicationException
*/
@SuppressWarnings("unchecked")
public ArrayList getProductByOff(int iStart, String pro, String city, String part) throws SaasApplicationException {
log.LOG_INFO("进入getProductByStock方法");
if (iStart > 1) {
iStart = (iStart - 1) * 10;
}
else {
iStart = 0;
}
ArrayList saleList = new ArrayList();
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VCITY", "%" + city + "%");
stockExt.setParam(":VPART", part);
saleList = stockExt.selByList("SEL_PRODUCT_NO_KEY", iStart, 10);
log.LOG_INFO("退出getProductByStock方法");
return saleList;
}
@SuppressWarnings("unchecked")
public int getProductByOff(String pro, String city, String part) throws SaasApplicationException {
int size = 0;
StockorderExt stockExt = new StockorderExt();
stockExt.setParam(":VPRO", "%" + pro + "%");
stockExt.setParam(":VCITY", "%" + city + "%");
stockExt.setParam(":VPART", part);
ArrayList list = stockExt.selByList("SEL_PRODUCT_NO_KEY");
if (list != null && list.size() > 0) {
size = list.size();
}
return size;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -