src/main/java/org/springblade/modules/InventoryLoss/controller/InventoryController.java
@@ -28,6 +28,7 @@ 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; @@ -36,6 +37,7 @@ 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; @@ -167,6 +169,11 @@ @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { Inventory inventory = inventoryService.getById(Long.parseLong(ids)); FarmProductStock farmProductStock = farmProductStockService.selectBy2Id(inventory.getStrainId(), inventory.getLandId()); Double weight = Double.parseDouble(farmProductStock.getWeight())+inventory.getSaleNum(); farmProductStock.setWeight(weight.toString()); farmProductStockService.updateById(farmProductStock); return R.status(inventoryService.deleteLogic(Func.toLongList(ids))); } src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -229,7 +229,7 @@ </select> <select id="selectByStrainId" resultType="org.springblade.modules.lang.entity.Land"> SELECT land.id,land.land_name,land.url,land.farm_id, SELECT land.id,land.land_name,land.url,land.farm_id FROM sys_land land LEFT JOIN sys_farm_product_stock fps ON fps.land_id = land.id WHERE fps.strain_id = #{strainId} src/main/java/org/springblade/modules/retrieval/controller/RetrievalController.java
@@ -29,6 +29,7 @@ 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.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestParam; @@ -131,6 +132,11 @@ @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { Retrieval retrieval = retrievalService.getById(Long.parseLong(ids)); FarmProductStock farmProductStock = farmProductStockService.selectBy2Id(retrieval.getStrainId(), retrieval.getLandId()); Double weight = Double.parseDouble(farmProductStock.getWeight())+retrieval.getSaleNum(); farmProductStock.setWeight(weight.toString()); farmProductStockService.updateById(farmProductStock); return R.status(retrievalService.deleteLogic(Func.toLongList(ids))); } src/main/java/org/springblade/modules/sale/controller/SaleController.java
@@ -29,11 +29,13 @@ 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.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.retrieval.entity.Retrieval; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestParam; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -172,6 +174,11 @@ @ApiOperationSupport(order = 7) @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()); Double weight = Double.parseDouble(farmProductStock.getWeight())+sale.getSaleNum(); farmProductStock.setWeight(weight.toString()); farmProductStockService.updateById(farmProductStock); return R.status(saleService.deleteLogic(Func.toLongList(ids))); }