// 启用或禁用订购合同订购合同
 @RequestMapping(value = "/enableOrDisable.json", method = RequestMethod.POST)
 @ResponseBody
 public Object enableOrDisable(@RequestParam List<String> purOrderIds, String status) {
   if (status.equals("disable")) { // 禁用
     return purchaseOrderService.disablePurchaseOrder(purOrderIds);
   } else { // 启用
     return purchaseOrderService.enablePurchaseOrder(purOrderIds);
   }
 }
 // 到货操作
 @RequestMapping(value = "/addArr.json", method = RequestMethod.POST)
 @ResponseBody
 private Object addArr(String purchaseArr, String data) {
   JSONObject purchase = JSONObject.fromObject(purchaseArr);
   PurchaseArrival arr = (PurchaseArrival) JSONObject.toBean(purchase, PurchaseArrival.class);
   JSONArray array = JSONArray.fromObject(data);
   List<PurchaseOrderDetail> list = new ArrayList<PurchaseOrderDetail>();
   for (int i = 0; i < array.toArray().length; i++) { // 遍历循环,去除最后一项统计栏的信息
     JSONObject json = JSONObject.fromObject(array.toArray()[i]);
     PurchaseOrderDetail resourceBean =
         (PurchaseOrderDetail) JSONObject.toBean(json, PurchaseOrderDetail.class);
     if (resourceBean.getGoodsCode().equals("<b>统计:</b>")) {
       continue;
     }
     if (arr.getNotPayAmo() == null) {
       arr.setNotPayAmo(new BigDecimal(0));
     }
     if (arr.getAlrInvAmo() == null) {
       arr.setAlrInvAmo(new BigDecimal(0));
     }
     if (arr.getNotReturnAmo() == null) {
       arr.setNotReturnAmo(new BigDecimal(0));
     }
     arr.setNotPayAmo(arr.getNotPayAmo().add(resourceBean.getMoney())); // 未付款金额
     arr.setAlrInvAmo(arr.getAlrInvAmo().add(resourceBean.getMoney())); // 已开票金额
     arr.setNotReturnAmo(arr.getNotReturnAmo().add(resourceBean.getMoney())); // 未退货金额
     list.add(resourceBean);
   }
   return purchaseOrderService.addPurchaseArr(arr, list);
 }
 // 审核批量订购合同
 @RequestMapping(value = "/auditList.json", method = RequestMethod.POST)
 @ResponseBody
 public Object auditList(PurchaseOrder order, HttpSession session) {
   @SuppressWarnings("unchecked")
   List<String> list = (List<String>) session.getAttribute("auditIds");
   session.removeAttribute("auditIds"); // 删除session
   return purchaseOrderService.auditPurchaseOrderList(order, list);
 }
 // 进入Detail信息页面
 @RequestMapping(value = "/intoDetail.htm")
 private Object intoPurchaseOrder(String purOrderId) {
   ModelAndView mav = new ModelAndView("purchase_mgr/purchaseOrder_mgr/purchaseOrder_detail");
   if (StringUtils.isNotBlank(purOrderId)) {
     mav.addObject("purchaseOrderData", purchaseOrderService.getPurchaseOrder(purOrderId));
   }
   return mav;
 }
 // 进入到货展示页面
 @RequestMapping(value = "/arr.htm")
 private Object arr(String purOrderId, HttpSession session) {
   ModelAndView mav = new ModelAndView("purchase_mgr/purchaseOrder_mgr/arr");
   mav.addObject("userDate", userService.getUserCombo(null)); // 员工信息
   mav.addObject("deliverTypeDate", deliverTypeService.getDeliverTypeCombo()); // 所属仓库
   mav.addObject("purchaseTypeDate", purchaseTypeService.getParPurchaseTypeCombo()); // 采购类型
   mav.addObject("suppliersDate", suppliersService.getSuppliersCombo()); // 供应商
   mav.addObject("suppliersLogisticsDate", suppliersService.getSuppliersLogisticsCombo()); // 物流供应商
   mav.addObject("paymentTypeDate", paymentTypeService.getParComPaymentTypeCombo()); // 约定支付
   mav.addObject("warehouseDate", warehouseService.getWareHouseCombo()); // 仓库
   mav.addObject("purchaseDate", purchaseOrderService.getPurchaseOrder(purOrderId));
   session.setAttribute("arrId", purOrderId);
   return mav;
 }
 // 进入表单页面
 @RequestMapping(value = "/intoForm.htm")
 private Object inForme(String purOrderId) {
   ModelAndView mav =
       new ModelAndView(
           "purchase_mgr/purchaseOrder_mgr/purchaseOrder_form"); // purchaseArrival_form2
   if (StringUtils.isNotBlank(purOrderId)) {
     mav.addObject("purchaseOrderData", purchaseOrderService.getPurchaseOrder(purOrderId));
   }
   mav.addObject("warehouseDate", warehouseService.getWareHouseCombo()); // 仓库
   mav.addObject("deliverTypeDate", deliverTypeService.getDeliverTypeCombo()); // 交货方式
   mav.addObject("purchaseTypeDate", purchaseTypeService.getParPurchaseTypeCombo()); // 采购类型
   mav.addObject("paymentTypeDate", paymentTypeService.getParComPaymentTypeCombo()); // 约定支付
   return mav;
 }
 // 修改订购合同
 @RequestMapping(value = "/edit.json", method = RequestMethod.POST)
 @ResponseBody
 private Object editPurchaseOrder(String purchaseOrder, String data) {
   JSONObject purchase = JSONObject.fromObject(purchaseOrder);
   PurchaseOrder order = (PurchaseOrder) JSONObject.toBean(purchase, PurchaseOrder.class);
   JSONArray array = JSONArray.fromObject(data);
   List<PurchaseOrderDetail> list = new ArrayList<PurchaseOrderDetail>();
   for (int i = 0; i < array.toArray().length; i++) { // 遍历循环,去除最后一项统计栏的信息
     JSONObject json = JSONObject.fromObject(array.toArray()[i]);
     PurchaseOrderDetail resourceBean =
         (PurchaseOrderDetail) JSONObject.toBean(json, PurchaseOrderDetail.class);
     if (resourceBean.getGoodsCode().equals("<b>统计:</b>") == false) {
       list.add(resourceBean);
     }
   }
   return purchaseOrderService.editPurchaseOrder(order, list);
 }
 // 批量取消审核订购合同
 @RequestMapping(value = "/batchCancelAudit.json", method = RequestMethod.POST)
 @ResponseBody
 public Object batchCancelAudit(@RequestParam List<String> purOrderIds) {
   return purchaseOrderService.batchCancelAudit(purOrderIds);
 }
 // 取消审核订购合同
 @RequestMapping(value = "/cancelAudit.json", method = RequestMethod.POST)
 @ResponseBody
 public Object cancelAuditPurchaseOrder(String purOrderId) {
   return purchaseOrderService.cancelAuditPurchaseOrder(purOrderId);
 }
 // 审核订购合同
 @RequestMapping(value = "/audit.json", method = RequestMethod.POST)
 @ResponseBody
 public Object auditPurchaseOrder(PurchaseOrder order) {
   return purchaseOrderService.auditPurchaseOrder(order);
 }
 // 删除订购合同
 @RequestMapping(value = "/del.json", method = RequestMethod.POST)
 @ResponseBody
 public Object delPurchaseOrder(
     @RequestParam List<String> purOrderIds, @RequestParam List<String> orderCodes) {
   return purchaseOrderService.delPurchaseOrder(purOrderIds, orderCodes);
 }
 // 获取表格结构的所有订购合同数据
 @RequestMapping(value = "/list.json", method = RequestMethod.POST)
 @ResponseBody
 private Object listPurchaseOrder(JqPager jqPager, PurchaseOrderQueryDTO purchaseOrderQueryDTO) {
   return purchaseOrderService.listAsGrid(jqPager, purchaseOrderQueryDTO);
 }
 // 进入订单审核页面
 @RequestMapping(value = "/auditForm.htm")
 private Object audit(String purOrderId) {
   ModelAndView mav = new ModelAndView("purchase_mgr/purchaseOrder_mgr/audit_form");
   mav.addObject("purchaseOrderData", purchaseOrderService.getPurchaseOrder(purOrderId));
   return mav;
 }