?? warehouseposinfo.java
字號:
package com.saas.biz.wareHousePosMgr;
import java.util.*;
import net.sf.json.JSONArray;
import com.saas.biz.JavaScriptObject.TreeNode;
import com.saas.biz.JavaScriptObject.TreeObject;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.repositoryDAO.RepositoryExt;
import com.saas.biz.dao.storeformInDAO.StoreformInExt;
import com.saas.biz.dao.wareHousePosDAO.WareHousePosDAO;
import com.saas.biz.dao.wareHousePosDAO.WareHousePosExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
public class WareHousePosInfo {
Dbtable tradeQuery;
Logger log;
Buffers inBuffer;
Buffers outBuffer;
ArrayList queryResult = new ArrayList();
public WareHousePosInfo()
{
log = new Logger(this);
tradeQuery = new Dbtable();
}
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;
}
public void addWareHousePosInfo(Buffers inbuffer)
{
log.LOG_INFO("進入addWareHousePosInfo方法...");
this.outBuffer = inbuffer;
String cust_id =inbuffer.getString("SESSION_CUST_ID");
String house_id=inbuffer.getString("HOUSE_ID");
String pos_id=inbuffer.getString("POS_ID");
String pos_name=inbuffer.getString("POS_NAME");
String up_pos_id=inbuffer.getString("UP_POS_ID");
String pos_no=inbuffer.getString("POS_NO");
String pos_area=inbuffer.getString("POS_AREA");
String capacity=inbuffer.getString("CAPACITY");
String max_capacity=inbuffer.getString("MAX_CAPACITY");
String pos_type=inbuffer.getString("POS_TYPE");
String state_code=inbuffer.getString("STATE_CODE");
String user_id=inbuffer.getString("SESSION_USER_ID");
String remark=inbuffer.getString("REMARK");
int iResult=-1 ;
try
{
iResult=addWareHousePosInfo(cust_id,house_id,pos_id,pos_name,up_pos_id,pos_no,pos_area,capacity,max_capacity,pos_type,state_code,user_id,remark);
}
catch(SaasApplicationException 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("退出addWareHousePosInfo方法...");
}
public int addWareHousePosInfo(String cust_id,String house_id,String pos_id,String pos_name,String up_pos_id,String pos_no,String pos_area,String capacity,String max_capacity,String pos_type,String state_code,String user_id,String remark) throws SaasApplicationException
{
WareHousePosExt wareHousePosExt = new WareHousePosExt();
wareHousePosExt.setParam(":VCUST_ID", cust_id);
wareHousePosExt.setParam(":VHOUSE_ID", house_id);
wareHousePosExt.setParam(":VPOS_ID", pos_id);
wareHousePosExt.setParam(":VPOS_NAME", pos_name);
wareHousePosExt.setParam(":VUP_POS_ID", up_pos_id);
wareHousePosExt.setParam(":VPOS_NO", pos_no);
wareHousePosExt.setParam(":VPOS_AREA", pos_area);
wareHousePosExt.setParam(":VCAPACITY", capacity);
wareHousePosExt.setParam(":VMAX_CAPACITY", max_capacity);
wareHousePosExt.setParam(":VPOS_TYPE", pos_type);
wareHousePosExt.setParam(":VSTATE_CODE", state_code);
wareHousePosExt.setParam(":VUSER_ID", user_id);
wareHousePosExt.setParam(":VREMARK", remark);
tradeQuery.executeBy(wareHousePosExt.insBy("INS_AREA_HOUSE_POS"));
return 0;
}
//修改倉位信息
public void updateWareHousePosInfo(Buffers inbuffer)
{
log.LOG_INFO("進入updateWareHousePosInfo方法...");
this.outBuffer = inbuffer;
String cust_id =inbuffer.getString("SESSION_CUST_ID");
String house_id=inbuffer.getString("HOUSE_ID");
String pos_id=inbuffer.getString("POS_ID");
String pos_name=inbuffer.getString("POS_NAME");
String up_pos_id=inbuffer.getString("UP_POS_ID");
String pos_no=inbuffer.getString("POS_NO");
String pos_area=inbuffer.getString("POS_AREA");
String capacity=inbuffer.getString("CAPACITY");
String max_capacity=inbuffer.getString("MAX_CAPACITY");
String pos_type=inbuffer.getString("POS_TYPE");
String state_code=inbuffer.getString("STATE_CODE");
String user_id=inbuffer.getString("SESSION_USER_ID");
String remark=inbuffer.getString("REMARK");
int iResult=-1 ;
try
{
iResult=updateWareHousePosInfo(cust_id,house_id,pos_id,pos_name,up_pos_id,pos_no,pos_area,capacity,max_capacity,pos_type,state_code,user_id,remark);
}
catch(SaasApplicationException 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("退出addWareHousePosInfo方法...");
}
public int updateWareHousePosInfo(String cust_id,String house_id,String pos_id,String pos_name,String up_pos_id,String pos_no,String pos_area,String capacity,String max_capacity,String pos_type,String state_code,String user_id,String remark) throws SaasApplicationException
{
WareHousePosExt wareHousePosExt = new WareHousePosExt();
wareHousePosExt.setParam(":VCUST_ID", cust_id);
wareHousePosExt.setParam(":VHOUSE_ID", house_id);
wareHousePosExt.setParam(":VPOS_ID", pos_id);
wareHousePosExt.setParam(":VPOS_NAME", pos_name);
wareHousePosExt.setParam(":VUP_POS_ID", up_pos_id);
wareHousePosExt.setParam(":VPOS_NO", pos_no);
wareHousePosExt.setParam(":VPOS_AREA", pos_area);
wareHousePosExt.setParam(":VCAPACITY", capacity);
wareHousePosExt.setParam(":VMAX_CAPACITY", max_capacity);
wareHousePosExt.setParam(":VPOS_TYPE", pos_type);
wareHousePosExt.setParam(":VSTATE_CODE", state_code);
wareHousePosExt.setParam(":VUSER_ID", user_id);
wareHousePosExt.setParam(":VREMARK", remark);
tradeQuery.executeBy(wareHousePosExt.insBy("UPDATE_AREA_HOUSE_POS"));
return 0;
}
public String getJsonDataForTree(String cust_id, String up_id, String img) throws SaasApplicationException {
String iconCls = img;
JSONArray jsonList = new JSONArray();
ArrayList rootList = getInfoByUpId(cust_id, up_id);
if (rootList != null && rootList.size() > 0) {
for (int i = 0; i < rootList.size(); i++) {
HashMap map = (HashMap) rootList.get(i);
TreeObject tree = new TreeObject();
String text = map.get("pos_name").toString();
String id = map.get("pos_id").toString();
tree.setIconCls(iconCls);
tree.setId(id);
tree.setText(text);
TreeNode node = isLeaf(cust_id, id);
tree.setChildren(node.getChildren());
tree.setLeaf(node.isLeaf());
jsonList.add(tree);
}
}
return jsonList.toString();
}
// 取出下一級
public ArrayList getInfoByUpId(String cust_id, String up_pos_id) throws SaasApplicationException {
ArrayList list = new ArrayList();
WareHousePosExt wareHousePosExt = new WareHousePosExt();
wareHousePosExt.setParam(":VCUST_ID", cust_id);
wareHousePosExt.setParam(":VUP_POS_ID", up_pos_id);
list = wareHousePosExt.selByList("SEL_BY_UP_ID");
return list;
}
public TreeNode isLeaf(String cust_id, String up_id) throws SaasApplicationException {
ArrayList nextList = getInfoByUpId(cust_id, up_id);
TreeNode node = new TreeNode();
if (nextList != null && nextList.size() > 0) {
node.setLeaf(false);
JSONArray children = getChildrenNodes(cust_id, up_id, nextList);
node.setChildren(children);
}
return node;
}
public JSONArray getChildrenNodes(String cust_id, String root_id, ArrayList nextList) throws SaasApplicationException {
JSONArray children = new JSONArray();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -