コード例 #1
0
 // 到货操作
 @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);
 }
コード例 #2
0
 // 修改订购合同
 @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);
 }