package com.bonus.material.part.controller;


import com.bonus.common.biz.annotation.StoreLog;
import com.bonus.common.biz.domain.purchase.PurchaseDto;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;

import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.ma.domain.TypeKeeper;
import com.bonus.material.part.domain.PartTypeCheckDetails;
import com.bonus.material.part.domain.PartTypeCheckInfo;
import com.bonus.material.part.domain.PartTypeDto;

import com.bonus.material.part.service.IPartAcceptService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;



/**
 * 配件入库管理Controller
 * 
 * @author hongchao
 * @date 2025-01-09
 */
@Api(tags = "配件入库管理接口")
@RestController
@RequestMapping("/part_accept")
public class partAcceptController extends BaseController {

    @Autowired
    private IPartAcceptService partAcceptService;

    /**
     * 获取配件入库类型下拉框
     */
    @ApiOperation(value = "获取配件入库类型下拉框")
//    @RequiresPermissions("scrap:details:list")
    @GetMapping("/partTypeThree")
    public AjaxResult partTypeThree(PartTypeDto partTypeDto) {
        return partAcceptService.getTypeTree(partTypeDto);
    }

    /**
     * 入库
     * @param partTypeCheckDetails
     * @return
     */
    @ApiOperation(value = "入库操作")
//    @RequiresPermissions("purchase:storage:add")
    @PostMapping("/partTypeWarehouse")
    public AjaxResult partTypeWarehouse(@RequestBody List<PartTypeCheckDetails> partTypeCheckDetails) {
        return partAcceptService.partTypeWarehouse(partTypeCheckDetails);
    }

    /**
     * 驳回
     * @param partTypeCheckDetails
     * @return
     */
    @ApiOperation(value = "驳回操作")
//    @RequiresPermissions("purchase:storage:add")
    @PostMapping("/partTypeReject")
    public AjaxResult partTypeReject(@RequestBody List<PartTypeCheckDetails> partTypeCheckDetails) {
        return partAcceptService.partTypeReject(partTypeCheckDetails);
    }

    /**
     * 外层入库
     * @param partTypeCheckInfo
     * @return
     */
    @ApiOperation(value = "入库操作")
//    @RequiresPermissions("purchase:storage:add")
    @PostMapping("/passAll")
    public AjaxResult passAll(@RequestBody List<PartTypeCheckInfo> partTypeCheckInfo) {
        return partAcceptService.passAll(partTypeCheckInfo);
    }

    /**
     * 外层驳回
     * @param partTypeCheckInfo
     * @return
     */
    @ApiOperation(value = "入库操作")
//    @RequiresPermissions("purchase:storage:add")
    @PostMapping("/rejectAll")
    public AjaxResult rejectAll(@RequestBody List<PartTypeCheckInfo> partTypeCheckInfo) {
        return partAcceptService.rejectAll(partTypeCheckInfo);
    }
}
