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);
|
}
|
}
|