| | |
| | | package com.ruoyi.inventory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.inventory.domain.StockIn; |
| | | import com.ruoyi.inventory.dto.StockManagementDto; |
| | | import com.ruoyi.inventory.dto.StockoutDto; |
| | | import com.ruoyi.inventory.mapper.StockManagementMapper; |
| | | import com.ruoyi.inventory.mapper.StockProductMapper; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import com.ruoyi.inventory.pojo.StockOut; |
| | | import com.ruoyi.inventory.service.StockOutService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import inventory.domain.StockOut; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/stockout") |
| | |
| | | @Autowired |
| | | private StockManagementMapper stockManagementMapper; |
| | | |
| | | @RequestMapping("/add") |
| | | public AjaxResult addStockOut(StockOut stockOut) { |
| | | int i = stockOutService.addStockOut(stockOut); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody StockOut stockout) { |
| | | stockOutService.saveStockout(stockout); |
| | | return AjaxResult.success(); |
| | | } |
| | | @RequestMapping("/list") |
| | | public AjaxResult listStockOuts() { |
| | | List<StockOut> stockOuts = stockOutService.getStockOuts(); |
| | | return success(stockOuts); |
| | | } |
| | | |
| | | @RequestMapping("/{id}") |
| | | public AjaxResult getStockOutById(@PathVariable Long id) { |
| | | StockOut stockOut = stockOutService.getStockOutById(id); |
| | | return success(stockOut); |
| | | return success(stockOutService.getStockOutById(id)); |
| | | } |
| | | @RequestMapping("/update") |
| | | public AjaxResult updateStockOut(@RequestBody StockOut stockOut) { |
| | | int i = stockOutService.updateStockOut(stockOut); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | @PutMapping("/update")// 更新入库记录 |
| | | public AjaxResult updateStockout(@RequestBody StockOut stockOut) { |
| | | stockOutService.updateStockOut(stockOut); |
| | | return AjaxResult.success(); |
| | | } |
| | | @RequestMapping("/delete/{id}") |
| | | public AjaxResult deleteStockOut(Long id) { |
| | | int i = stockOutService.deleteStockOut(id); |
| | | if(i>0){ |
| | | return success(); |
| | | @RequestMapping("/page") |
| | | public AjaxResult getStockOutPage(Page page, StockoutDto stockOutdto) { |
| | | IPage<StockoutDto> stockOutPage = stockOutService.selectStockOutPage(page, stockOutdto); |
| | | return success(stockOutPage); |
| | | } |
| | | // 导出 |
| | | @PostMapping("/export") |
| | | public void stockoutExport(HttpServletResponse response, StockoutDto stockoutDto) { |
| | | stockOutService.stockoutExport(response, stockoutDto); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStockOut(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | } |
| | | return error(); |
| | | stockOutService.delStockOut(ids); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |