chenhj
8 天以前 c4174bbb103d95d6cd4714d3cc3070559444d70e
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
@@ -7,24 +7,26 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.stock.dto.StockInRecordDto;
import com.ruoyi.stock.service.StockInRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Api(tags = "入库")
@Tag(name = "入库")
@RequestMapping("/stockInRecord")
@RequiredArgsConstructor
public class StockInRecordController {
    @Autowired
    private StockInRecordService stockInRecordService;
    private final StockInRecordService stockInRecordService;
    @GetMapping("/listPage")
    @Log(title = "生产入库-入库管理-列表", businessType = BusinessType.OTHER)
    @ApiOperation(value = "入库管理列表")
    @Operation(summary = "入库管理列表")
    public AjaxResult listPage(Page page, StockInRecordDto stockInRecordDto) {
        IPage<StockInRecordDto> result = stockInRecordService.listPage(page, stockInRecordDto);
        return AjaxResult.success(result);
@@ -41,4 +43,31 @@
        return AjaxResult.success(stockInRecordService.batchDelete(ids));
    }
    @DeleteMapping("/pending")
    @Log(title = "入库管理-删除待审批入库", businessType = BusinessType.DELETE)
    @Operation(summary = "删除待审批的入库记录")
    public AjaxResult deletePending(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)){
            return AjaxResult.error("请选择至少一条数据");
        }
        return AjaxResult.success(stockInRecordService.batchDeletePending(ids));
    }
    @PostMapping("/exportStockInRecord")
    @Operation(summary = "导出入库记录")
    public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) {
        stockInRecordService.exportStockInRecord(response,stockInRecordDto);
    }
    @PostMapping("/approve")
    @Log(title = "入库管理-审批入库", businessType = BusinessType.UPDATE)
    @Operation(summary = "批量审批入库记录")
    public AjaxResult approve(@RequestBody StockInRecordDto approveDto) {
        if(CollectionUtils.isEmpty(approveDto.getIds())){
            return AjaxResult.error("请选择至少一条数据");
        }
        stockInRecordService.batchApprove(approveDto.getIds(), approveDto.getApprovalStatus());
        return AjaxResult.success();
    }
}