Example #1
0
 // *************************************合同产品
 // 关联合同产品的查询
 @RequestMapping(value = "/cxhtcp", method = RequestMethod.POST)
 public void cxhtcp(
     PrintWriter out,
     HttpServletResponse response,
     HttpServletRequest request,
     HttpSession session,
     @RequestParam(value = "htglid", required = false) Long htglid) {
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   String strJson = "{\"total\":\"0\",\"rows\":[]}";
   try {
     htcp htcp = new htcp();
     htcp.setHtglid(htglid);
     List<Object[]> lstDaily = htglDao.cxhtcp(htcp);
     if (null != lstDaily && lstDaily.size() > 0) {
       List<Map<String, Object>> lstMap = new ArrayList<Map<String, Object>>();
       for (Object[] obj : lstDaily) {
         Map<String, Object> map = new HashMap<String, Object>();
         //						id
         map.put("htcpid", obj[0]);
         //						产品编码
         map.put("cpbm", obj[1]);
         //						产品名称
         map.put("cpmc", obj[2]);
         //						规格型号
         map.put("ggxh", obj[3]);
         //						类别
         map.put("lb", obj[4]);
         //						数量
         map.put("sl", obj[5]);
         //						单价
         map.put("dj", obj[6]);
         //						金额
         map.put("je", obj[7]);
         //						备注
         map.put("bz", obj[8]);
         lstMap.add(map);
       }
       response.setContentType("text/json; charset=utf-8");
       response.setCharacterEncoding("UTF-8");
       String json = JSONUtils.toJson(lstMap);
       strJson = "{\"rows\":" + json + "}";
     }
     out.println(strJson);
   } catch (Exception e) {
     e.printStackTrace();
   }
   out.close();
   System.out.println(strJson);
 }
Example #2
0
 // 修改合同产品
 @RequestMapping(value = "/updatehtcp", method = RequestMethod.POST)
 public void updatehtcp(HttpServletRequest request, PrintWriter out, HttpSession session) {
   try {
     Operator sessionOperator = (Operator) session.getAttribute("obj_login_operator");
     htcp htcp = new htcp();
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
     // id
     String htcpid = request.getParameter("htcpid");
     Long htcpid1 = Long.parseLong(htcpid);
     htcp.setHtcpid(htcpid1);
     //		产品编码
     String cpbm = request.getParameter("cpbm");
     htcp.setCpbm(cpbm);
     //		产品名称
     String cpmc = request.getParameter("cpmc");
     htcp.setCpmc(cpmc);
     //		规格型号
     String ggxh = request.getParameter("ggxh");
     htcp.setGgxh(ggxh);
     //		类别
     String lb = request.getParameter("lb");
     htcp.setLb(lb);
     //		数量
     String sl = request.getParameter("sl");
     htcp.setSl(sl);
     //		单价
     String dj = request.getParameter("dj");
     htcp.setDj(dj);
     //		金额
     String je = request.getParameter("je");
     htcp.setJe(je);
     //		备注
     String bz = request.getParameter("bz");
     htcp.setBz(bz);
     // 合同管理
     htcp htcp1 = htglDao.gethtcpid(htcpid1);
     htcp.setHtglid(htcp1.getHtglid());
     dailyLog.LogInfomation(
         sessionOperator.getEmployeeId(), sessionOperator.getOperatorId(), "合同管理", "3");
     htglDao.updatehtcp(htcp);
     out.println("{success:true}");
   } catch (Exception e) {
     e.printStackTrace();
   }
   out.close();
 }