智慧农业后台管理
guoshilong
2022-08-23 918032ec4d745924bbed1d405e93a219b6a6f6f0
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)));
   }