POS管理系统之设备出库

时间:2023-03-09 13:20:21
POS管理系统之设备出库

JSP:

<html>
  <head>
    <title>登录</title>
   <style type="text/css">
       table{
         color: blue;
         font-weight: bold;
         text-align: center;
         border-color: #C1DCF9;
       }
    </style>
  </head>
 
  <body>
    <form action="<%=request.getContextPath()%>/equipOut.do" method="post">
    <table border="1">
      <tr>
       <td>客户编号</td>
       <td><input type="text" name="userno"></td>
       <td>客户名称</td>
       <td><input type="text" name="username"></td>
      </tr>
      <tr>
         <td>经办人</td>
         <td><input type="text" name="people"></td>
         <td>出库日期</td>
         <td><input type="text" name="date"></td>
      </tr>
      <tr>
          <td>设备编号</td>
       <td>设备种类</td>
       <td>备注</td>
       <td>操作</td>
      </tr>
      <tr>
          <td><input type="text" name="equipno"/></td>
                <td></td>
                <td><input type="text" name="beizhu"></td>
                <td><a href="#">删除</a></td>
      </tr>
      <tr>
           <td colspan="3"></td>
           <td><a href="#">添加</a></td>
      </tr>
      <tr>
           <td colspan="4" class="a"><input type="submit" value="保存">
           </td>
      </tr>
     </table>
    </form>
  
  </body>
</html>

DAO:

public class EquipOutDao extends BaseDao{
    public int insertout(EquipOut e){
     String select="insert into outku values(?,?,?,?,?,?)";
     List<Object> params=new ArrayList<Object>();
     params.add(e.getUserno());
        params.add(e.getUsername());
        params.add(e.getPeople());
        params.add(e.getOutdate());
        params.add(e.getEquipno());
        params.add(e.getBeizhu());
     return this.executeUpdate(select, params);
    }
}

实体类:

public class EquipOut {
 private String userno;
 private String username;
 private String people;
 private String outdate;
 private String equipno;
 private String beizhu;
public String getUserno() {
 return userno;
}
public void setUserno(String userno) {
 this.userno = userno;
}
public String getUsername() {
 return username;
}
public void setUsername(String username) {
 this.username = username;
}
public String getPeople() {
 return people;
}
public void setPeople(String people) {
 this.people = people;
}
public String getOutdate() {
 return outdate;
}
public void setOutdate(String outdate) {
 this.outdate = outdate;
}
public String getEquipno() {
 return equipno;
}
public void setEquipno(String equipno) {
 this.equipno = equipno;
}
public String getBeizhu() {
 return beizhu;
}
public void setBeizhu(String beizhu) {
 this.beizhu = beizhu;
}
public EquipOut(String userno, String username, String people, String outdate,
  String equipno, String beizhu) {
 super();
 this.userno = userno;
 this.username = username;
 this.people = people;
 this.outdate = outdate;
 this.equipno = equipno;
 this.beizhu = beizhu;
}
public EquipOut() {
 super();
 // TODO Auto-generated constructor stub
}

SERVICE:

public class EquipOutService {
  EquipOutDao eod=new EquipOutDao();
  public int insertout(EquipOut e){
   return eod.insertout(e);
  }
}

SERVLET:

public class EquipOutServlet extends HttpServlet {

@Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
   throws ServletException, IOException {
  
  doPost(req, resp);
 }

@Override
 protected void doPost(HttpServletRequest req, HttpServletResponse resp)
   throws ServletException, IOException {
  req.setCharacterEncoding("utf-8");
  String userno=req.getParameter("userno");
  String username=req.getParameter("username");
  String people=req.getParameter("people");
  String outdate=req.getParameter("outdate");
  String equipno=req.getParameter("equipno");
  String beizhu=req.getParameter("beizhu");
  EquipOutService eos=new EquipOutService();
  EquipOut eo=new EquipOut(userno, username, people, outdate, equipno, beizhu);
     int a=eos.insertout(eo);
     if(a>0){
      resp.sendRedirect(req.getContextPath()+"/tiaozhuan/Success.jsp");
     }else{
      resp.sendRedirect("http://www.baidu.com");
     }
 }

}