| | |
| | | package com.ruoyi.inventory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.inventory.mapper.StockManagementMapper; |
| | | import com.ruoyi.inventory.mapper.StockProductMapper; |
| | | import com.ruoyi.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.excel.StockInExcelDto; |
| | | import com.ruoyi.inventory.service.StockInService; |
| | | import com.ruoyi.inventory.domain.StockIn; |
| | | import com.ruoyi.project.system.domain.SysPost; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/stockin") |
| | | public class StockInController extends BaseController { |
| | | public class StockInController{ |
| | | @Autowired |
| | | private StockInService stockInService; |
| | | @Autowired |
| | | private StockManagementMapper stockManagementMapper; |
| | | @PostMapping("/add")// 新增入库记录 |
| | | public AjaxResult addStockIn(@RequestBody StockIn stockIn) { |
| | | int i = stockInService.addStockIn(stockIn); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, StockinDto stockinDto) { |
| | | return AjaxResult.success(stockInService.selectStockInPage(page,stockinDto)); |
| | | } |
| | | @GetMapping("/list")// 列出所有入库记录 |
| | | public AjaxResult listStockIns() { |
| | | List<StockIn> stockIns = stockInService.listStockIns(); |
| | | return success(stockIns); |
| | | |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody StockIn stockIn) { |
| | | stockInService.saveStockin(stockIn); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @GetMapping("/{id}")// 根据ID获取入库记录 |
| | | public AjaxResult getStockInById(@PathVariable Long id) { |
| | | StockIn stockIn = stockInService.getStockInById(id); |
| | | return success(stockIn); |
| | | return AjaxResult.success(stockIn); |
| | | } |
| | | @PutMapping("/update")// 更新入库记录 |
| | | public AjaxResult updateStockIn(@RequestBody StockIn stockIn) { |
| | | int i = stockInService.updateStockIn(stockIn); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | @DeleteMapping("/delete/{id}")// 删除入库记录 |
| | | public AjaxResult deleteStockIn(@PathVariable Long id) { |
| | | int i = stockInService.deleteStockIn(id); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | // @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | // @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @GetMapping("/export")// 导出入库数据 |
| | | public AjaxResult exportStockInData() { |
| | | List<StockIn> stockIns = stockInService.listStockIns(); |
| | | ExcelUtil<StockIn> util = new ExcelUtil<StockIn>(StockIn.class); |
| | | util.exportExcel(stockIns, "库存入库信息"); |
| | | return success(); |
| | | stockInService.updateStockIn(stockIn); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStockin(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | } |
| | | stockInService.delStockin(ids); |
| | | return AjaxResult.success(); |
| | | } |
| | | //导出 |
| | | @Log(title = "入库档案", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, StockinDto stockinDto) { |
| | | stockInService.stockinExport(response, stockinDto); |
| | | } |
| | | } |