wangfei
2024-12-31 4ed47bfce9b3edd78ea447ecffc0babebdbea10b
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java
@@ -2,14 +2,18 @@
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.entity.request.HollowTaskRequest;
import com.mes.hollow.service.HollowGlassOutRelationInfoService;
import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
import com.mes.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
 * (HollowGlassOutRelationInfo)表控制层
@@ -17,6 +21,7 @@
 * @author makejava
 * @since 2024-11-30 13:57:28
 */
@Api(tags = "中空任务关系")
@RestController
@RequestMapping("hollowGlassOutRelationInfo")
public class HollowGlassOutRelationInfoController {
@@ -26,19 +31,66 @@
    @ApiOperation("领取任务")
    @PostMapping("/receiveTask")
    public Result<HollowGlassOutRelationInfo> receiveTask(String flowCardId, int cell, int totalPairQuantity) {
        return Result.success(hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity));
    public Result<HollowGlassOutRelationInfo> receiveTask(HollowTaskRequest request) {
        HollowGlassOutRelationInfo hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService.receiveTask(request);
        if (null == hollowGlassOutRelationInfo) {
            return Result.error(500, "当前流程卡有未完成的任务,请先确保任务完成后,再次领取任务");
        } else {
            return Result.success(hollowGlassOutRelationInfo);
        }
    }
    @ApiOperation("强制出片")
    @PostMapping("/forceOutGlass")
    public Result<HollowGlassOutRelationInfo> forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
        return Result.success(hollowGlassOutRelationInfoService.forceOutGlass(flowCardId, cell, totalPairQuantity));
    public Result<HollowGlassOutRelationInfo> forceOutGlass(HollowTaskRequest request) {
        HollowGlassOutRelationInfo hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService.forceOutGlass(request);
        if (null == hollowGlassOutRelationInfo) {
            return Result.error(500, "当前流程卡有未完成的任务,请先确保任务完成后,再次强制执行任务");
        } else {
            return Result.success(hollowGlassOutRelationInfo);
        }
    }
    @ApiOperation("流程卡任务列表")
    @PostMapping("/hollowTaskList")
    public Result<List<String>> hollowTaskList(int cell) {
        return Result.build(200, "流程卡任务列表查询成功", hollowGlassOutRelationInfoService.hollowTaskList(cell));
    }
    @ApiOperation("预览指定任务信息")
    @PostMapping("/appointHollowTaskDetails")
    public Result<List<HollowGlassQueueInfo>> appointHollowTaskDetails(String flowCardId, int cell) {
        return Result.build(200, "预览指定任务信息成功", hollowGlassOutRelationInfoService.appointHollowTaskDetails(flowCardId, cell));
    }
    @ApiOperation("删除指定任务信息")
    @PostMapping("/deleteHollowTaskDetails")
    public Result<Boolean> deleteHollowTaskDetails(String flowCardId, int cell) {
        return Result.build(200, "预览指定任务信息成功", hollowGlassOutRelationInfoService.deleteHollowTaskDetails(flowCardId, cell));
    }
    @ApiOperation("开始任务")
    @PostMapping("/startTask")
    public Result<Boolean> startTask(String flowCardId, int cell) {
        return Result.build(200, "开始任务成功", hollowGlassOutRelationInfoService.startTask(flowCardId, cell));
    }
    @ApiOperation("暂停任务")
    @PostMapping("/pauseTask")
    public Result<Boolean> pauseTask(String flowCardId, int cell) {
        return Result.build(200, "暂停任务成功", hollowGlassOutRelationInfoService.pauseTask(flowCardId, cell));
    }
    @ApiOperation("结束任务")
    @PostMapping("/finishTask")
    public Result<Boolean> finishTask(String flowCardId, int cell) {
        return Result.build(200, "结束任务成功", hollowGlassOutRelationInfoService.finishTask(flowCardId, cell));
    }
    @ApiOperation("是否调度开关")
    @PostMapping("/dispatchHollowSwitch")
    public Result<Boolean> dispatchHollowSwitch(Boolean flag) {
        return Result.build(200, "修改成功",hollowGlassOutRelationInfoService.dispatchHollowSwitch(flag));
        return Result.build(200, "修改成功", hollowGlassOutRelationInfoService.dispatchHollowSwitch(flag));
    }
}