コード例 #1
0
 @Override
 public String deleteSalesbackData(String salesbackSerialNumber) {
   SalesbackGoodsExample example = new SalesbackGoodsExample();
   example.createCriteria().andSalesbackSerialNumberEqualTo(salesbackSerialNumber);
   List<SalesbackGoods> salesbackGoodsList = salesbackGoodsService.selectByExample(example);
   for (SalesbackGoods salesbackGoods : salesbackGoodsList) {
     TbStoragecheck storagecheck = new TbStoragecheck();
     storagecheck = storagecheckService.selectByKey(salesbackGoods.getStorageId());
     if (storagecheck.getEndtime() != null) {
       storagecheck.setEndtime(null);
       storagecheck.setStorageRateCurrent(salesbackGoods.getGoodsAmount());
       storagecheckService.updateTbStoragecheck(storagecheck);
     } else {
       storagecheck.setStorageRateCurrent(
           storagecheck.getStorageRateCurrent() + salesbackGoods.getGoodsAmount());
       storagecheckService.updateTbStoragecheck(storagecheck);
     }
     salesbackGoodsService.deleteByPrimaryKey(salesbackGoods.getSalesbackGoodsId());
   }
   salesbackService.deleteByPrimaryKey(salesbackSerialNumber);
   return "SUCCESS";
 }
コード例 #2
0
 @Override
 public String updateSalesbackInfo(
     String goodsAmountList,
     String salesbackSerialNumber,
     String salesbackType,
     String salesbackReason,
     String storageIdList) {
   Salesback salesback = salesbackService.selectByPrimaryKey(salesbackSerialNumber);
   SalesbackGoodsExample example = new SalesbackGoodsExample();
   example.createCriteria().andSalesbackSerialNumberEqualTo(salesbackSerialNumber);
   List<SalesbackGoods> salesbackGoodsList = salesbackGoodsService.selectByExample(example);
   String[] goodsAmounts = goodsAmountList.split(",");
   String[] storageIds = storageIdList.split(",");
   for (int i = 0; i < salesbackGoodsList.size(); i++) {
     int count = salesbackGoodsList.get(i).getGoodsAmount() - Integer.parseInt(goodsAmounts[i]);
     if (count != 0) {
       salesbackGoodsList.get(i).setGoodsAmount(Integer.parseInt(goodsAmounts[i]));
       TbStoragecheck storagecheck = new TbStoragecheck();
       storagecheck = storagecheckService.selectByKey(Integer.parseInt(storageIds[i]));
       if (storagecheck.getStorageRateCurrent() == count) {
         storagecheck.setStorageRateCurrent(0);
         storagecheck.setEndtime(new java.util.Date());
       } else if (storagecheck.getStorageRateCurrent() + count < 0) {
         return "ERROE";
       } else {
         storagecheck.setStorageRateCurrent(storagecheck.getStorageRateCurrent() + count);
       }
       salesbackGoodsService.update(salesbackGoodsList.get(i));
       storagecheckService.updateTbStoragecheck(storagecheck);
     }
   }
   salesback.setSalesbackReason(salesbackReason);
   salesback.setSalesbackType(salesbackType);
   salesbackService.update(salesback);
   return "SUCCESS";
 }