예제 #1
0
  /**
   * 根据os订单编号从发货单查询os订单
   *
   * @param request
   * @param response
   * @throws Exception
   */
  @RequestMapping(value = "/queryDegByDocCode")
  public void queryDegByDocCode(HttpServletRequest request, HttpServletResponse response)
      throws MbvException, Exception {
    // 先在客户端验证用户以及它的手机号码
    Map<String, Object> map = new HashMap<String, Object>();

    try {
      HttpSession session = request.getSession();
      String unitCode = (String) session.getAttribute(MbvConstant.UNIT_CODE);

      String docCode = request.getParameter("docCode");
      log.info("WnController.queryDegByDocCode -> docCode: " + docCode);

      DegBean bean = new DegBean();
      bean.setUnitCode(unitCode);
      bean.setOrderSn(docCode);

      //        	Map<String, Object> paraMap = new HashMap<String, Object>();
      //            paraMap.put("unitCode", unitCode);
      //            paraMap.put("orderSn", docCode);
      log.info("WnController.queryDegByDocCode -> paraMap: " + bean);

      int cnt = wnService.selectDegByOrderSnAndUnitCode(bean);
      log.info("WnController.queryDegByDocCode -> cnt: " + cnt);
      if (cnt <= 0) {
        map.put("status", "ERROR");
        map.put("reason", "找不到对应的OS订单编号");
        this.returnSuccess(response, map);
      } else {
        WnBean wnBean = new WnBean();
        wnBean.setUnitCode(unitCode);
        wnBean.setOrderSn(docCode);
        wnBean.setDocState("1"); // 处理中
        log.info("WnController.queryExitsWnCount -> paraMap: " + wnBean);
        int exitsWnCnt = wnService.queryExitsWnCount(wnBean);
        if (exitsWnCnt > 0) {
          map.put("status", "ERROR");
          map.put("reason", "此OS订单编号正在处理中,不能重复新增工单");
        } else {
          map.put("success", true);
        }
      }
    } catch (MbvException e) {
      throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (RuntimeException e) {
      throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }

    this.returnSuccess(response, map);
  }
예제 #2
0
  /**
   * @功能描述:查询库存表 @2015年9月6日
   *
   * @param
   * @version
   * @throws MbvException
   */
  @RequestMapping(value = "/queryByParams", method = RequestMethod.POST)
  @ResponseBody
  public JqGridBaseEntityVo<WnBean> queryByParams(
      JqGridBaseEntityVo<WnBean> entity,
      WnVo vo,
      HttpServletRequest request,
      HttpServletResponse response)
      throws MbvException {
    // 如果vo为空,则抛出异常
    if (vo == null || vo.getBean() == null) {
      throw new MbvException("传入参数有误!");
    }
    try {
      List<WnBean> list = new ArrayList<WnBean>();
      // 查询总条数
      WnBean bean = vo.getBean();

      String weekFrom = bean.getWeekFrom();
      String weekTo = bean.getWeekTo();
      log.info("WnController.queryByParams -> weekFrom: " + weekFrom + ", weekTo:" + weekTo);

      // date
      if (StringUtils.isNotEmpty(weekFrom) && StringUtils.isNotEmpty(weekTo)) {
        bean.setWeekFrom(weekFrom);
        bean.setWeekTo(weekTo);
        bean.setDay("");
        bean.setMonth("");
      } else if ((StringUtils.isNotEmpty(weekFrom) && weekFrom.trim().length() == 10)
          || (StringUtils.isNotEmpty(weekTo) && weekTo.trim().length() == 10)) {
        bean.setWeekFrom("");
        bean.setWeekTo("");
        bean.setMonth("");
        bean.setDay(weekFrom + weekTo);
      } else if ((StringUtils.isNotEmpty(weekFrom) && weekFrom.trim().length() == 7)
          || (StringUtils.isNotEmpty(weekTo) && weekTo.trim().length() == 7)) {
        bean.setWeekFrom("");
        bean.setWeekTo("");
        bean.setDay("");
        bean.setMonth(weekFrom + weekTo);
      } else {
        bean.setWeekFrom("");
        bean.setWeekTo("");
        bean.setDay("");
        bean.setMonth("");
      }

      HttpSession session = request.getSession();
      String user = (String) session.getAttribute(MbvConstant.USER_CODE);
      String unitCode = (String) session.getAttribute(MbvConstant.UNIT_CODE);
      bean.setUnitCode(unitCode);

      int totalCount = wnService.queryByParamsCount(bean);
      log.info("totalCount:" + totalCount);
      // 如果查询不到,择返回
      if (totalCount > 0) {
        // 组装分页数据
        int offset = (entity.getPage() - 1) * entity.getRows();
        int limit = entity.getRows();
        // 获取数据
        list = wnService.queryByParams(vo.getBean(), offset, limit);
        // 设置分页条数
        JqGridPagesUtils.setPagingParams(entity, list, totalCount);
      }
    } catch (MbvException e) {
      throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (RuntimeException e) {
      throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
    // 返回查询结果
    return entity;
  }