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.StockInUnQualifiedRecordTypeEnum;
import com.ruoyi.common.enums.StockOutUnQualifiedRecordTypeEnum;
import com.ruoyi.consumables.dto.ConsumablesInventoryDto;
import com.ruoyi.consumables.dto.ConsumablesUnInventoryDto;
import com.ruoyi.consumables.service.ConsumablesUnInventoryService;
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 javax.servlet.http.HttpServletResponse;
/**
*
* 耗材不合格库存表 前端控制器
*
*
* @author 芯导软件(江苏)有限公司
* @since 2026-01-22 10:17:45
*/
@Api(tags = "耗材不合格")
@RestController
@RequestMapping("/consumablesUnInventory")
public class ConsumablesUnInventoryController {
@Autowired
private ConsumablesUnInventoryService consumablesUnInventoryService;
@GetMapping("/pageConsumablesUnInventory")
@ApiOperation("分页查询库存")
public R pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto) {
IPage ConsumablesUnInventoryDtoIPage = consumablesUnInventoryService.pageConsumablesUnInventory(page, consumablesUnInventoryDto);
return R.ok(ConsumablesUnInventoryDtoIPage);
}
@PostMapping("/addConsumablesUnInventory")
@ApiOperation("新增库存")
public R addConsumablesUnInventory(@RequestBody ConsumablesUnInventoryDto consumablesUnInventoryDto) {
consumablesUnInventoryDto.setRecordType(String.valueOf(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()));
consumablesUnInventoryDto.setRecordId(0L);
return R.ok(consumablesUnInventoryService.addConsumablesUnInventory(consumablesUnInventoryDto));
}
@PostMapping("/subtractConsumablesUnInventory")
@ApiOperation("扣减库存")
public R subtractConsumablesUnInventory(@RequestBody ConsumablesUnInventoryDto consumablesUnInventoryDto) {
consumablesUnInventoryDto.setRecordType(String.valueOf(StockOutUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
consumablesUnInventoryDto.setRecordId(0L);
return R.ok(consumablesUnInventoryService.subtractConsumablesUnInventory(consumablesUnInventoryDto));
}
@PostMapping("/exportConsumablesUnInventory")
@ApiOperation("导出库存")
public void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto consumablesUnInventoryDto) {
consumablesUnInventoryService.exportConsumablesUnInventory(response,consumablesUnInventoryDto);
}
@PostMapping("/frozenConsumables")
@ApiOperation("冻结库存")
public R frozenConsumables(@RequestBody ConsumablesInventoryDto consumablesUnInventoryDto) {
return R.ok(consumablesUnInventoryService.frozenConsumables(consumablesUnInventoryDto));
}
@PostMapping("/thawConsumables")
@ApiOperation("解冻库存")
public R thawConsumables(@RequestBody ConsumablesInventoryDto consumablesUnInventoryDto) {
return R.ok(consumablesUnInventoryService.thawConsumables(consumablesUnInventoryDto));
}
}