| | |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.farmplant.service.FarmProductStockService; |
| | | import org.springblade.modules.process.service.IProcessService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | |
| | | private final ISaleService saleService; |
| | | private final FarmProductStockService farmProductStockService; |
| | | private final IProcessService processService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | return R.status(saleService.saveOrUpdate(sale)); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 销售记录表(加工产品) |
| | | */ |
| | | @PostMapping("/submitProcess") |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "新增或修改", notes = "传入sale") |
| | | public R submitProcess(@Valid @RequestBody SaleVO sale) { |
| | | //对比加工表库存量 |
| | | boolean res = processService.stockCompare(sale.getSaleNum(),sale.getProid()); |
| | | if (!res){ |
| | | throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前库存不足!")); |
| | | }else { |
| | | //库存充足,减去相应库存 |
| | | processService.stockReduce(sale.getSaleNum(),sale.getProid()); |
| | | } |
| | | return R.status(saleService.saveOrUpdate(sale)); |
| | | } |
| | | |
| | | /** |
| | | * 删除 销售记录表 |