lishenao
9 小时以前 5c1a58d067512df6099f9cc95f577c9991128163
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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.dto.StockinDto;
import com.ruoyi.inventory.excel.StockInExcelDto;
import com.ruoyi.inventory.service.StockInService;
import com.ruoyi.inventory.pojo.StockIn;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
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.Date;
import java.util.List;
 
@RestController
@RequestMapping("/stockin")
public class StockInController{
    @Autowired
    private StockInService stockInService;
 
    @GetMapping("/listPage")
    public AjaxResult listPage(Page page, StockinDto stockinDto) {
        return AjaxResult.success(stockInService.selectStockInPage(page,stockinDto));
    }
 
    @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 AjaxResult.success(stockIn);
    }
    @PutMapping("/update")// 更新入库记录
    public AjaxResult updateStockIn(@RequestBody StockIn stockIn) {
        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);
    }
}