📄 insertstockinaction.java
字号:
package com.wl.actionimpl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.wl.action.Action;
import com.wl.dao.EmployeeinfoDAO;
import com.wl.dao.GoodsInfoDAO;
import com.wl.dao.TypeDAO;
import com.wl.entity.EmployeeInfo;
import com.wl.entity.GoodsInfo;
import com.wl.entity.StockInInfo;
import com.wl.entity.Type;
public class InsertstockinAction implements Action {
public String doExcute(HttpServletRequest request,
HttpServletResponse response) {
String chargeperson = request.getParameter("stockincharge");
System.out.print("++++++++++++++++++++++++++++++"+chargeperson);
String goodsname = request.getParameter("goodsname");
int num = Integer.parseInt(request.getParameter("stockinnum"));
System.out.print("++++++++++++++++++++++++++++++"+num);
String type = request.getParameter("type");
String remarkinfo = request.getParameter("remarkinfo");
StockInInfo st = new StockInInfo ();
EmployeeinfoDAO edao = new EmployeeinfoDAO();//通过负责人名称获得对应的id号
List<EmployeeInfo> elist=new ArrayList<EmployeeInfo>();
elist=edao.selectEmployeeInfoByName(chargeperson);
Iterator<EmployeeInfo> it = elist.iterator();
int id=-1 ;
while(it.hasNext()){
EmployeeInfo employeeinfo = (EmployeeInfo)it.next();
id = employeeinfo.getId();
}
st.setChargeId(id);
GoodsInfoDAO gdao = new GoodsInfoDAO();//通过货物名称获得对应的id号
List<GoodsInfo> glist=new ArrayList<GoodsInfo>();
glist=gdao.selectGoodsInfoByGoodsName(goodsname);
Iterator<GoodsInfo> it1 = glist.iterator();
int gid=-1;
while(it1.hasNext()){
GoodsInfo goodsinfo =(GoodsInfo)it1.next();
gid = goodsinfo.getId();
st.setGoodsId(gid);
}
st.setGoodsInNumber(num);
//通过商品型号名称获得对应的id号
TypeDAO tdao = new TypeDAO();
List<Type> tlist = new ArrayList<Type>();
tlist = tdao.selectTypeByName(type);
Iterator<Type> it3 =tlist.iterator();
int tid=-1;
while(it3.hasNext()){
Type typ = (Type)it3.next();
tid = typ.getId();
//st.setTypeId(tid);
}
System.out.print("++++++++++++++++++++"+tid);
st.setGoodsInMemo(remarkinfo);
// boolean b = dao.addStockIn(id,gid, num, cid, tid, remarkinfo);
// if(b==true){
return "/admin/stockinshow.jsp";
// }
// else{
// return "/admin/error.jsp";
// }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -