廖井涛
2024-08-29 07d08f8dc420ba47f66587fdc5038a59fc340c96
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportingWorkController.java
@@ -5,8 +5,10 @@
import com.example.erp.common.Result;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.ReportingWork;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.pp.ReportingWorkService;
import com.example.erp.service.userInfo.LogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,18 +22,22 @@
public class ReportingWorkController {
    final
    ReportingWorkService reportingWorkService;
    LogService logService;
    public ReportingWorkController(ReportingWorkService reportingWorkService) {
    public ReportingWorkController(ReportingWorkService reportingWorkService,LogService logService) {
        this.reportingWorkService = reportingWorkService;
        this.logService =  logService;
    }
    @ApiOperation("报工新增查询")
    @PostMapping  ("/addSelectLastWork/{processIdStr}/{technologyStr}/{process}")
    @SaCheckPermission("AddReportingWork.search")
    @PostMapping  ("/addSelectLastWork/{processIdStr}/{technologyStr}/{process}/{reportType}")
    public Result AddSelectLastWork(
            @PathVariable String processIdStr,
            @PathVariable String technologyStr,
            @PathVariable String process)  {
        return  Result.seccess(reportingWorkService.AddSelectLastWorkSv(processIdStr,technologyStr,process));
            @PathVariable String process,
            @PathVariable String reportType)  {
        return  Result.seccess(reportingWorkService.AddSelectLastWorkSv(processIdStr,technologyStr,process,reportType));
    }
    @ApiOperation("查询工序")
    @PostMapping  ("/selectProcess")
@@ -81,15 +87,12 @@
    @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));
    @PostMapping("/deleteWork/{reportingWorkId}/{processId}/{thisProcess}/{userId}/{userName}")
    public Result deleteWork(@PathVariable String reportingWorkId,@PathVariable String processId,
                             @PathVariable String thisProcess,@PathVariable String userId
    ,@PathVariable String userName){
        return Result.seccess(reportingWorkService.deleteWorkSv(reportingWorkId,processId,thisProcess,userId,userName));
    }
@@ -130,4 +133,25 @@
        return Result.seccess(reportingWorkService.detailsQualitySv(reportingWorkId,processId,thisProcess,reportingWork));
    }
    @ApiOperation("补片状态查询")
    @PostMapping  ("/getPatchCondition/{reportingWorkId}")
    public Result getPatchCondition(
            @PathVariable String reportingWorkId)  {
        return  Result.seccess(reportingWorkService.getPatchConditionSv(reportingWorkId));
    }
    @ApiOperation("mes报工接口")
    @PostMapping  ("/mesReportingWork")
    public Result mesReportingWork(@RequestBody Map<String,Object> reportingWork){
        Boolean aBoolean = reportingWorkService.mesReportingWorkSv(reportingWork);
        if(aBoolean){
            return Result.seccess(reportingWorkService.mesReportingWorkSv(reportingWork));
        }else{
            throw new ServiceException(Constants.Code_600, "上工序已完工数量小于本工序报工数量,请检查");
        }
    }
}