Junjie
昨天 2825b82e8a4eca618ab3c2306de2db74a2ecbd1d
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -27,12 +27,15 @@
import com.zy.core.thread.StationThread;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import com.zy.system.service.HighPrivilegeGrantService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
@@ -60,6 +63,10 @@
    private ConfigService configService;
    @Autowired
    private DeviceConfigService deviceConfigService;
    @Autowired
    private HighPrivilegeGrantService highPrivilegeGrantService;
    @Autowired
    private HttpServletRequest request;
    // 移库任务
    @PostMapping("/createLocMoveTask")
@@ -111,19 +118,11 @@
        if (param == null) {
            return R.error("参数不能为空");
        }
        List<CreateOutTaskParam> taskList = param.getTaskList();
        if (taskList == null || taskList.size() == 0) {
            return R.error("任务列表不能为空");
        boolean result = commonService.createOutTaskBatch(param);
        if (result) {
            return R.ok();
        }
        for (CreateOutTaskParam createOutTaskParam : taskList) {
            if (createOutTaskParam == null) {
                throw new CoolException("任务参数不能为空");
            }
            commonService.createOutTask(createOutTaskParam);
        }
        return R.ok();
        return R.error("生成批量出库任务失败");
    }
    @PostMapping("/completeTask")
@@ -145,7 +144,13 @@
        if (param == null) {
            return R.error("参数不能为空");
        }
        boolean completeTask = commonService.cancelTask(param);
        boolean directCancel = false;
        try {
            highPrivilegeGrantService.assertGranted(request.getHeader("token"), "取消任务");
            directCancel = true;
        } catch (CoolException ignore) {
        }
        boolean completeTask = commonService.cancelTask(param, directCancel);
        if (completeTask) {
            return R.ok();
        }
@@ -171,7 +176,13 @@
        if (param == null) {
            return R.error("参数不能为空");
        }
        CancelTaskBatchResult result = commonService.cancelTaskBatch(param);
        boolean directCancel = false;
        try {
            highPrivilegeGrantService.assertGranted(request.getHeader("token"), "取消任务");
            directCancel = true;
        } catch (CoolException ignore) {
        }
        CancelTaskBatchResult result = commonService.cancelTaskBatch(param, directCancel);
        return R.ok().add(result);
    }
@@ -188,6 +199,16 @@
        return R.error("修改任务优先级和批次序号失败");
    }
    @PostMapping("/cancelOutTaskBatchInfo")
    @OpenApiLog(memo = "取消出库任务批次和批次序号")
    public R cancelOutTaskBatchInfo(@RequestBody CancelTaskBatchParam param) {
        if (param == null) {
            return R.error("参数不能为空");
        }
        CancelTaskBatchResult result = commonService.cancelOutTaskBatchInfo(param);
        return R.ok().add(result);
    }
    @PostMapping("/deviceStatus")
    // @OpenApiLog(memo = "获取设备状态")
    public R getDeviceStatus() {