/**
   * 根据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);
  }
  @RequestMapping(value = "/getProdInfoByProdNum", method = RequestMethod.POST)
  @ResponseBody
  public void getProdInfoByProdNum(HttpServletRequest request, HttpServletResponse response)
      throws MbvException {
    Map<String, Object> map = new HashMap<String, Object>();
    String prodNum = request.getParameter("prodNum");
    String orderSn = request.getParameter("orderSn");
    log.info("wn->prodNum:" + prodNum + ",orderSn:" + orderSn);
    if (prodNum == null || "".equals(prodNum)) {
      throw new MbvException("参数错误!商品编码不能为空!");
    }
    if (prodNum.length() != 11) {
      throw new MbvException("参数错误!商品编码必须11位!");
    }
    try {
      HttpSession session = request.getSession();
      String unitCode = (String) session.getAttribute(MbvConstant.UNIT_CODE);

      DegBean bean = new DegBean();
      bean.setProdNum(prodNum);
      bean.setOrderSn(orderSn);
      bean.setUnitCode(unitCode);

      log.info("getProdInfoByProdNum prodNum:" + prodNum);
      DegBean pi = wnService.selectDegBySku(bean);
      //			if (pi == null) {
      //				throw new MbvException("获取商品信息失败!");
      //			}
      log.info("getProdInfoByProdNum:" + pi);
      if (pi == null) {
        map.put("status", "ERROR");
        map.put("reason", "获取商品信息失败!");
      } else {
        map.put("status", "");
        map.put("success", true);
        map.put("data", pi);
      }
      // 保存成功
      returnSuccess(response, map);
    } catch (MbvException me) {
      throw new MbvException("获取商品信息失败!");
    } catch (RuntimeException re) {
      throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (Exception e) {
      throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
  }