package com.example.erp.controller.pp; import cn.dev33.satoken.annotation.SaCheckPermission; import com.example.erp.common.Constants; import com.example.erp.common.Result; import com.example.erp.entity.pp.FlowCard; import com.example.erp.entity.pp.ReportingWork; import com.example.erp.exception.ServiceException; import com.example.erp.service.pp.ReportingWorkService; 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.Map; import java.sql.Date; @RestController @RequestMapping("/reportingWork") @Api(value="报工controller",tags={"报工控制器"}) public class ReportingWorkController { final ReportingWorkService reportingWorkService; public ReportingWorkController(ReportingWorkService reportingWorkService) { this.reportingWorkService = reportingWorkService; } @ApiOperation("报工新增查询") @PostMapping ("/addSelectLastWork/{processIdStr}/{technologyStr}/{process}") public Result AddSelectLastWork( @PathVariable String processIdStr, @PathVariable String technologyStr, @PathVariable String process) { return Result.seccess(reportingWorkService.AddSelectLastWorkSv(processIdStr,technologyStr,process)); } @ApiOperation("查询工序") @PostMapping ("/selectProcess") public Result SelectProcess() { return Result.seccess(reportingWorkService.SelectProcessSv()); } @ApiOperation("报工新增") @SaCheckPermission("AddReportingWork.add") @PostMapping ("/saveReportingWork") public Result SaveReportingWork(@RequestBody Map reportingWork) { return Result.seccess(reportingWorkService.SaveReportingWorkSv(reportingWork)); } @ApiOperation("报工审核") @SaCheckPermission("AddReportingWork.review") @PostMapping ("/reviewReportingWork") public Result ReviewReportingWork(@RequestBody Map reportingWork) { return Result.seccess(reportingWorkService.ReviewReportingWorkSv(reportingWork)); } @ApiOperation("报工修改查询") @PostMapping ("/selectUpdateReportingWork/{reportingWorkId}") public Result SelectUpdateReportingWork(@PathVariable String reportingWorkId) { return Result.seccess(reportingWorkService.selectUpdateReportingWorkSv(reportingWorkId)); } @ApiOperation("报工修改") @SaCheckPermission("AddReportingWork.update") @PostMapping ("/updateReportingWork/{reviewState}") public Result updateReportingWork(@PathVariable String reviewState,@RequestBody Map reportingWork) { return Result.seccess(reportingWorkService.updateReportingWork(reportingWork,reviewState)); } @ApiOperation("报工查询接口") @SaCheckPermission("SelectReportingWorks.search") @PostMapping ("/selectReportingWork/{pageNum}/{pageSize}/{selectTime1}/{selectTime2}/{orderId}") public Result selectReportingWork( @PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable Date selectTime1, @PathVariable Date selectTime2, @PathVariable String orderId, @RequestBody ReportingWork reportingWork){ return Result.seccess(reportingWorkService.selectReportingWorkSv(pageNum,pageSize,selectTime1,selectTime2,orderId,reportingWork)); } @ApiOperation("删除报工接口") @SaCheckPermission("SelectReportingWorks.delete") @PostMapping("/deleteWork/{reportingWorkId}/{processId}/{thisProcess}") public Result deleteWork(@PathVariable String reportingWorkId,@PathVariable String processId,@PathVariable String thisProcess){ // if(reportingWorkService.deleteWorkSv(reportingWorkId,processId,thisProcess)){ // return Result.seccess(); // }else { // throw new ServiceException(Constants.Code_500,"删除失败,请检查是否符合删除条件"); // // } return Result.seccess(reportingWorkService.deleteWorkSv(reportingWorkId,processId,thisProcess)); } @ApiOperation("质检审核查询接口") @SaCheckPermission("QualityInspectionReview.search") @PostMapping ("/selectQualityTesting/{pageNum}/{pageSize}/{selectTime1}/{selectTime2}/{state}/{processId}") public Result selectQualityTesting( @PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable Date selectTime1, @PathVariable Date selectTime2, @PathVariable Integer state, @PathVariable String processId, @RequestBody ReportingWork reportingWork){ return Result.seccess(reportingWorkService.selectQualityTestingSv(pageNum,pageSize,selectTime1,selectTime2,state,processId,reportingWork)); } @ApiOperation("质检审核审核") @SaCheckPermission("QualityInspectionReview.review") @PostMapping ("/updateQualityStatus/{reportingWorkId}/{username}") public Result updateQualityStatus(@PathVariable String reportingWorkId,@PathVariable String username) { if(reportingWorkService.updateQualityStatusSv(reportingWorkId,username)){ return Result.seccess(); }else { throw new ServiceException(Constants.Code_500,"审核失败"); } } @ApiOperation("质检审核明细查询接口") @PostMapping ("/detailsQuality/{reportingWorkId}/{processId}/{thisProcess}") public Result detailsQuality( @PathVariable String reportingWorkId, @PathVariable String processId, @PathVariable String thisProcess, @RequestBody ReportingWork reportingWork){ return Result.seccess(reportingWorkService.detailsQualitySv(reportingWorkId,processId,thisProcess,reportingWork)); } }