| | |
| | | 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.farmplant.entity.FarmProductStock; |
| | | import org.springblade.modules.farmplant.service.FarmProductStockService; |
| | | import org.springblade.modules.InventoryLoss.entity.Inventory; |
| | | import org.springblade.modules.InventoryLoss.service.InventoryService; |
| | |
| | | import org.springblade.modules.process.service.IProcessService; |
| | | import org.springblade.modules.processInv.entity.ProcessInv; |
| | | import org.springblade.modules.processInv.service.IProcessInvService; |
| | | import org.springblade.modules.processInv.vo.ProcessInvVO; |
| | | import org.springblade.modules.sale.entity.Sale; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | |
| | | //库存充足,减去相应库存 |
| | | farmProductStockService.stockReduce(inventory.getSaleNum(),inventory.getProid()); |
| | | } |
| | | inventory.setProdId(inventory.getProid()); |
| | | return R.status(inventoryService.saveOrUpdate(inventory)); |
| | | } |
| | | |
| | |
| | | processInv.setUpdateUser(inventory.getCreateUser()); |
| | | processInv.setUpdateTime(new Date()); |
| | | processInv.setId(Long.parseLong(inventory.getProid())); |
| | | ProcessInvVO processInvVO = processInvService.getLand(processInv); |
| | | inventory.setLandId(processInvVO.getLandId()); |
| | | processInvService.updateById(processInv); |
| | | } |
| | | inventory.setProdId(inventory.getProid()); |
| | | return R.status(inventoryService.saveOrUpdate(inventory)); |
| | | } |
| | | |
| | |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | Inventory inventory = inventoryService.getById(Long.parseLong(ids)); |
| | | if (inventory.getType() == 0){ |
| | | FarmProductStock farmProductStock = farmProductStockService.getById(inventory.getProdId()); |
| | | Double weight = Double.parseDouble(farmProductStock.getWeight())+inventory.getSaleNum(); |
| | | farmProductStock.setWeight(weight.toString()); |
| | | farmProductStockService.updateById(farmProductStock); |
| | | }else { |
| | | ProcessInv inv = processInvService.findById(inventory.getProdId()); |
| | | Double weight = inv.getProductInventoryNum()+inventory.getSaleNum(); |
| | | inv.setProductInventoryNum(weight); |
| | | processInvService.updateById(inv); |
| | | } |
| | | return R.status(inventoryService.deleteLogic(Func.toLongList(ids))); |
| | | } |
| | | |