| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.InventoryLoss.entity.Inventory; |
| | | import org.springblade.modules.farmplant.entity.FarmProductStock; |
| | | import org.springblade.modules.farmplant.service.FarmProductStockService; |
| | | import org.springblade.modules.process.service.IProcessService; |
| | |
| | | //库存充足,减去相应库存 |
| | | farmProductStockService.stockReduce(sale.getSaleNum(),sale.getProid()); |
| | | } |
| | | sale.setProdId(sale.getProid()); |
| | | return R.status(saleService.saveOrUpdate(sale)); |
| | | } |
| | | |
| | |
| | | sale.setLandId(processInvVO.getLandId()); |
| | | processInvService.updateById(processInv); |
| | | } |
| | | sale.setProdId(sale.getProid()); |
| | | return R.status(saleService.saveOrUpdate(sale)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | Sale sale = saleService.getById(Long.parseLong(ids)); |
| | | FarmProductStock farmProductStock = farmProductStockService.selectBy2Id(sale.getStrainId(), sale.getLandId()); |
| | | if (sale.getType() == 0){ |
| | | FarmProductStock farmProductStock = farmProductStockService.getById(sale.getProdId()); |
| | | Double weight = Double.parseDouble(farmProductStock.getWeight())+sale.getSaleNum(); |
| | | farmProductStock.setWeight(weight.toString()); |
| | | farmProductStockService.updateById(farmProductStock); |
| | | }else { |
| | | ProcessInv inv = processInvService.findById(sale.getProdId()); |
| | | Double weight = inv.getProductInventoryNum()+sale.getSaleNum(); |
| | | inv.setProductInventoryNum(weight); |
| | | processInvService.updateById(inv); |
| | | } |
| | | return R.status(saleService.deleteLogic(Func.toLongList(ids))); |
| | | } |
| | | |