package com.ruoyi.consumables.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
|
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.consumables.dto.ConsumablesInventoryDto;
|
import com.ruoyi.consumables.execl.ConsumablesInventoryExportData;
|
import com.ruoyi.consumables.service.ConsumablesInventoryService;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.framework.web.domain.R;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* <p>
|
* 耗材库存表 前端控制器
|
* </p>
|
*
|
* @author 芯导软件(江苏)有限公司
|
* @since 2026-01-21 04:16:36
|
*/
|
@RestController
|
@RequestMapping("/consumablesInventory")
|
@Api(tags = "耗材库存表")
|
public class ConsumablesInventoryController {
|
|
@Autowired
|
private ConsumablesInventoryService ConsumablesInventoryService;
|
|
@GetMapping("/pageConsumablesInventory")
|
@ApiOperation("分页查询库存")
|
public R pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) {
|
IPage<ConsumablesInventoryDto> ConsumablesInventoryDtoIPage = ConsumablesInventoryService.pageConsumablesInventory(page, ConsumablesInventoryDto);
|
return R.ok(ConsumablesInventoryDtoIPage);
|
}
|
|
@PostMapping("/addConsumablesInventory")
|
@ApiOperation("新增库存")
|
public R addConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
|
ConsumablesInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()));
|
ConsumablesInventoryDto.setRecordId(0L);
|
return R.ok(ConsumablesInventoryService.addConsumablesInventory(ConsumablesInventoryDto));
|
}
|
|
|
@PostMapping("/subtractConsumablesInventory")
|
@ApiOperation("扣减库存")
|
public R subtractConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
|
ConsumablesInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode()));
|
ConsumablesInventoryDto.setRecordId(0L);
|
return R.ok(ConsumablesInventoryService.subtractConsumablesInventory(ConsumablesInventoryDto));
|
}
|
|
|
@PostMapping("importConsumablesInventory")
|
@ApiOperation("导入库存")
|
public R importConsumablesInventory(MultipartFile file) {
|
return ConsumablesInventoryService.importConsumablesInventory(file);
|
}
|
|
@Log(title = "下载库存导入模板", businessType = BusinessType.EXPORT)
|
@PostMapping("/downloadConsumablesInventory")
|
public void downloadConsumablesInventory(HttpServletResponse response) {
|
List<ConsumablesInventoryExportData> list = new ArrayList<>();
|
ExcelUtil<ConsumablesInventoryExportData> util = new ExcelUtil<>(ConsumablesInventoryExportData.class);
|
util.exportExcel(response, list, "库存模板");
|
}
|
|
@PostMapping("/exportConsumablesInventory")
|
@ApiOperation("导出库存")
|
public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) {
|
ConsumablesInventoryService.exportConsumablesInventory(response, ConsumablesInventoryDto);
|
}
|
|
@GetMapping("ConsumablesInventoryPage")
|
@ApiOperation("库存报表查询")
|
public R ConsumablesInventoryPage(Page page, ConsumablesInventoryDto consumablesInventoryDto) {
|
return R.ok(ConsumablesInventoryService.consumablesInventoryPage(consumablesInventoryDto,page));
|
}
|
|
@GetMapping("ConsumablesInAndOutRecord")
|
@ApiOperation("统计各个产品的入库和出库记录")
|
public R ConsumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) {
|
return R.ok(ConsumablesInventoryService.consumablesInAndOutRecord(consumablesInventoryDto,page));
|
}
|
|
@PostMapping("/frozenConsumables")
|
@ApiOperation("冻结库存")
|
public R frozenConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
|
return R.ok(ConsumablesInventoryService.frozenConsumables(ConsumablesInventoryDto));
|
}
|
|
@PostMapping("/thawConsumables")
|
@ApiOperation("解冻库存")
|
public R thawConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
|
return R.ok(ConsumablesInventoryService.thawConsumables(ConsumablesInventoryDto));
|
}
|
}
|