?? goodsinfo.java
字號:
package com.saas.biz.goodsMgr;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Map.Entry;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.goodsDAO.GoodsDAO;
import com.saas.biz.dao.goodsDAO.GoodsExt;
import com.saas.biz.dao.storeformInDAO.StoreformInExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import com.saas.biz.custMgr.*;
public class GoodsInfo {
Dbtable tradeQuery;
commMethodMgr comm;
Logger log;
Buffers inBuffer;
Buffers outBuffer;
ArrayList queryResult = new ArrayList();
public GoodsInfo() {
log = new Logger(this);
tradeQuery = new Dbtable();
comm = new commMethodMgr();
}
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;
}
public ArrayList getQueryResult() {
return this.queryResult;
}
public void setQueryResult(ArrayList queryResult) {
this.queryResult = queryResult;
}
/**
* 新增群組 user_id:是多個人員的id,以|分隔
*
* @param inbuffer
*/
public void addGoodsInfo(Buffers inbuffer) {
log.LOG_INFO("進入addGoodsInfo方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
String cust_id = inbuffer.getString("SESSION_CUST_ID");
String goods_id = inbuffer.getString("GOODS_ID");
String goods_name = inbuffer.getString("GOODS_NAME");
String goods_desc = inbuffer.getString("GOODS_DESC");
String goods_no = inbuffer.getString("GOODS_NO");
String store_no = inbuffer.getString("STORE_NO");
String goods_type = inbuffer.getString("GOODS_TYPE");
String store_type = inbuffer.getString("STORE_TYPE");
String fix_tag = inbuffer.getString("FIX_TAG");
String maker = inbuffer.getString("MAKER");
String src = inbuffer.getString("SRC");
String start_date = inbuffer.getString("START_DATE");
String end_date = inbuffer.getString("END_DATE");
String now_num = inbuffer.getString("QUO_NUM");
String user_id = inbuffer.getString("SESSION_USER_ID");
String publish_date = inbuffer.getString("PUBLISH_DATE");
String remark = inbuffer.getString("REMARK2");
int i=checkGoods(cust_id,goods_id);
try {
if(i==0){
iResult = addGoodsInfo(cust_id, goods_id, goods_name, goods_desc,
goods_no, store_no, goods_type,store_type, fix_tag, maker, src,
start_date, end_date, now_num, user_id, publish_date,
remark);
}else{
iResult = updateGoodsInfo(cust_id, goods_id, goods_name, goods_desc,
goods_no, store_no, goods_type,store_type, fix_tag, maker, src,
start_date, end_date, now_num, user_id, publish_date,
remark);
}
} catch (Exception e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "業務處理失敗!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "業務處理成功!");
}
log.LOG_INFO("退出addGoodsInfo方法...");
}
public int addGoodsInfo(String cust_id, String goods_id, String goods_name,
String goods_desc, String goods_no, String store_no,
String goods_type,String store_type, String fix_tag, String maker, String src,
String start_date, String end_date, String now_num, String user_id,
String publish_date, String remark) throws SaasApplicationException {
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
goodsExt.setParam(":VGOODS_ID",goods_id);
goodsExt.setParam(":VGOODS_NAME",goods_name);
goodsExt.setParam(":VGOODS_DESC",goods_desc);
goodsExt.setParam(":VGOODS_NO",goods_no);
goodsExt.setParam(":VSTORE_NO",store_no);
goodsExt.setParam(":VGOODS_TYPE",goods_type);
goodsExt.setParam(":VSTORE_TYPE",store_type);
goodsExt.setParam(":VFIX_TAG",fix_tag);
goodsExt.setParam(":VMAKER",maker);
goodsExt.setParam(":VSRC",src);
goodsExt.setParam(":VSTART_DATE",start_date);
goodsExt.setParam(":VEND_DATE",end_date);
goodsExt.setParam(":VNOW_NUM",now_num);
goodsExt.setParam(":VUSER_ID",user_id);
goodsExt.setParam(":VPUBLISH_DATE",publish_date);
goodsExt.setParam(":VREMARK",remark);
tradeQuery.executeBy(goodsExt.insBy("INS_All_GOODS"));
log.LOG_INFO("==========="+goodsExt.insBy("INS_All_GOODS")+"==================");
return 0;
}
public int updateGoodsInfo(String cust_id, String goods_id, String goods_name,
String goods_desc, String goods_no, String store_no,
String goods_type,String store_type, String fix_tag, String maker, String src,
String start_date, String end_date, String now_num, String user_id,
String publish_date, String remark) throws SaasApplicationException {
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
goodsExt.setParam(":VGOODS_ID",goods_id);
goodsExt.setParam(":VGOODS_NAME",goods_name);
goodsExt.setParam(":VGOODS_DESC",goods_desc);
goodsExt.setParam(":VGOODS_NO",goods_no);
goodsExt.setParam(":VSTORE_NO",store_no);
goodsExt.setParam(":VGOODS_TYPE",goods_type);
goodsExt.setParam(":VSTORE_TYPE",store_type);
goodsExt.setParam(":VFIX_TAG",fix_tag);
goodsExt.setParam(":VMAKER",maker);
goodsExt.setParam(":VSRC",src);
goodsExt.setParam(":VSTART_DATE",start_date);
goodsExt.setParam(":VEND_DATE",end_date);
goodsExt.setParam(":VNOW_NUM",now_num);
goodsExt.setParam(":VUSER_ID",user_id);
goodsExt.setParam(":VPUBLISH_DATE",publish_date);
goodsExt.setParam(":VREMARK",remark);
tradeQuery.executeBy(goodsExt.insBy("UPDATE_All_GOODS"));
return 0;
}
public int checkGoods(String cust_id,String goods_id){
ArrayList list = new ArrayList();
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
goodsExt.setParam(":VGOODS_ID",goods_id);
list = goodsExt.selByList("SEL_GOODS_BY_ID");
if(list!=null&&list.size()>0){
return 1;
}else{
return 0;
}
}
public String getGoodsName(String cust_id){
ArrayList list = new ArrayList();
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
list = goodsExt.selByList("SEL_GOODS_NAME_BY_ID");
String str="";
if(list!=null&&list.size()>0){
for (int i = 0; i < list.size(); i++) {
HashMap map = (HashMap)list.get(i);
String goods_name = map.get("goods_name").toString();
String goods_id = map.get("goods_id").toString();
str=str+"<option value="+goods_id+">"+goods_name+"</option>";
}
}
return str;
}
//找出所有增品
public String getGoodsByType(String cust_id,String type)throws SaasApplicationException{
ArrayList list = new ArrayList();
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
goodsExt.setParam(":VGOODS_TYPE",type);
list = goodsExt.selByList("SEL_GOODS_BY_TYPE");
String str="";
if(list!=null&&list.size()>0){
for (int i = 0; i < list.size(); i++) {
HashMap map = (HashMap)list.get(i);
String goods_name = map.get("goods_name").toString();
String goods_id = map.get("goods_id").toString();
str=str+"<option value="+goods_id+">"+goods_name+"</option>";
}
}
return str;
}
public ArrayList getGoodsListByType(String cust_id,String type)throws SaasApplicationException{
ArrayList list = new ArrayList();
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
goodsExt.setParam(":VGOODS_TYPE",type);
list = goodsExt.selByList("SEL_GOODS_BY_TYPE");
return list;
}
public HashMap getOneGoods(String cust_id,String goods_id){
ArrayList list = new ArrayList();
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
goodsExt.setParam(":VGOODS_ID",goods_id);
list = goodsExt.selByList("SEL_GOODS_BY_ID");
HashMap map = new HashMap();
if(list!=null&&list.size()>0){
map = (HashMap)list.get(0);
}
return map;
}
public ArrayList getGoodsNames(String cust_id) throws SaasApplicationException {
ArrayList relationList = new ArrayList();
GoodsExt relaExt = new GoodsExt();
relaExt.setParam(":VCUST_ID", cust_id);
relationList = relaExt.selByList("SEL_GOODS_BY_CUST_ID");
return relationList;
}
//取物料名
public ArrayList getById(String cust_id) throws SaasApplicationException {
ArrayList relationList = new ArrayList();
GoodsExt relaExt = new GoodsExt();
relaExt.setParam(":VCUST_ID", cust_id);
relationList = relaExt.selByList("SEL_BY_ID");
return relationList;
}
public ArrayList getAllGoods(int iStart,String cust_id) throws SaasApplicationException{
GoodsExt goodsExt = new GoodsExt();
ArrayList list = new ArrayList();
try {
iStart = iStart*20;
goodsExt.setParam(":VCUST_ID",cust_id);
list = goodsExt.selByList("SEL_BY_ID", iStart, 20);
}
catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
return list;
}
public int getAllGoods(String cust_id) throws SaasApplicationException{
GoodsExt goodsExt = new GoodsExt();
ArrayList list = new ArrayList();
int count=0;
try {
goodsExt.setParam(":VCUST_ID",cust_id);
list = goodsExt.selByList("SEL_BY_ID");
}
catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
if(list!=null && list.size()>0){
count=list.size();
}
return count;
}
public void updateDoor(Buffers inbuffer) {
log.LOG_INFO("進入updateDoor方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
String cust_id = inbuffer.getString("SESSION_CUST_ID");
String goods_id = inbuffer.getString("GOODS_ID");
String max_door = inbuffer.getString("MAX_DOOR");
String min_door = inbuffer.getString("MIN_DOOR");
try {
iResult = updateDoor(cust_id,max_door,min_door,goods_id);
} catch (Exception e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "業務處理失敗!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "業務處理成功!");
}
log.LOG_INFO("退出updateDoor方法...");
}
public int updateDoor(String cust_id, String max_door,String min_door,String goods_id) throws SaasApplicationException {
GoodsExt goodsExt = new GoodsExt();
goodsExt.setParam(":VCUST_ID",cust_id);
goodsExt.setParam(":VGOODS_ID",goods_id);
goodsExt.setParam(":VMAX_DOOR",max_door);
goodsExt.setParam(":VMIN_DOOR",min_door);
tradeQuery.executeBy(goodsExt.insBy("UPDATE_GOODS_DOOR"));
return 0;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -