zss
2023-08-21 82fbcce60ae86965441ae045df1f864d10005d35
inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java
@@ -22,6 +22,7 @@
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.limslaboratory.service.InspectionService;
import javax.annotation.Resource;
/**
@@ -67,40 +68,17 @@
    @GetMapping("/selectAll")
    public Result selectAll(Integer type) {
        switch (type) {
            case 0 :
            case 0:
                //原材料
                return Result.success(rawMaterialService.selectRawmaAll());
            case 1 :
            case 1:
                //委托单
                return Result.success(linkBasicInformationService.selectLinkAll());
            case 2 :
            case 2:
                //成品检验
                return Result.success("请输入检验信息!");
        }
        return Result.fail("类型错误!");
    }
    @ApiOperation(value = "选择原材料报检")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "原材料报检单id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "startTime", value = "检验开始日期", dataTypeClass = String.class, required = true),
            @ApiImplicitParam(name = "endTime", value = "检验结束日期", dataTypeClass = String.class, required = true)
    })
    @GetMapping("/selectRawmaById")
    public Result selectRawmaById(Integer id, String startTime, String endTime) throws ParseException {
        return Result.success(rawMaterialService.selectRawmaById(id,startTime,endTime));
    }
    @ApiOperation(value = "选择委托报检和样品")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "bid", value = "委托报检单id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "did", value = "委托报检样品id", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/selectLinkByid")
    public Result selectLinkByid(Integer bid, Integer did) {
        return Result.success(linkBasicInformationService.selectLinkByid(bid, did));
    }
@@ -112,7 +90,7 @@
        return Result.success(inspectionService.addInspect((Integer) unmarshal.get("id"), inspectionVo));
    }
    @ApiOperation(value = "根据检验单id查询原材料检验单详情")
    @ApiOperation(value = "根据检验单id查询检验单详情")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true)
    })
@@ -121,19 +99,15 @@
        return Result.success(inspectionService.selectInspectsListById(id));
    }
    @ApiOperation(value = "上报(更新检验状态)")
    @ApiOperation(value = "作废检验单")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/updateInspectsById")
    public Result updateInspectsById(Integer id) {
        //如果已经上报了不能再一次上报
        Inspection inspection = inspectionService.getById(id);
        if (ObjectUtils.isNotEmpty(inspection.getInspectionStatus())) {
            return Result.fail("已经上报过了,不能再次上报!");
        }
        return Result.success(inspectionService.updateInspectsById(id));
    @PostMapping("/delInspect")
    public Result delInspect(Integer id)  {
        return Result.success(inspectionService.delInspect(id));
    }
}