自动化立体仓库 - WMS系统
zyh
昨天 3bf6f972604761c9ac59a2cb9ea01eeacaec2189
src/main/java/com/zy/asrs/task/handler/AGVTaskReportHandler.java
@@ -7,7 +7,10 @@
import com.zy.asrs.service.RcsService;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.common.properties.StationProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -23,9 +26,12 @@
    @Resource
    private RcsService rcsService;
    @Autowired
    private StationProperties stationProperties;
    public ReturnT<String> start(Task task) {
        String taskType = "NB1";
        String SourceStaNoType = "SITE";
        String TargetStaNoType = "SITE";
        //给agv下发的任务类型,默认站到站
@@ -37,21 +43,71 @@
        }else if(task.getIoType()==5){
            SourceStaNoType = "ZONE";
        }
        Boolean flag1 = false;
        Boolean flag2 = false;
        Boolean cpFlag1 = false;
        Boolean cpFlag2 = false;
        if(stationProperties.getStation().contains(task.getStaNo())){
            taskType = "LJIN";
            flag1 = true;
        }
        if (stationProperties.getStation().contains(task.getSourceStaNo())) {
            taskType = "LJOUT";
            flag2 = true;
        }
        if(flag1 && flag2) {
            taskType = "LJBOTH";
        }
        if (task.getStaNo().equals("Z-LVL18")){
            taskType = "LJCPIN";
        }
        if (task.getSourceStaNo().equals("Z-LVL18")){
            taskType = "LJCPOUT";
        }
        if (task.getSourceStaNo().equals("Z-LVL20")||task.getSourceStaNo().equals("Z-LVL21")||task.getSourceStaNo().equals("Z-LVL22")||
                task.getSourceStaNo().equals("Z-LVL23")||task.getSourceStaNo().equals("Z-LVL24")||task.getSourceStaNo().equals("Z-LVL25")||
                task.getSourceStaNo().equals("Z-LVL26")||task.getSourceStaNo().equals("Z-LVL27")||task.getSourceStaNo().equals("Z-LVL28")||
                task.getSourceStaNo().equals("Z-LVL29")||task.getSourceStaNo().equals("Z-LVL30")||task.getSourceStaNo().equals("Z-LVL31")){
            taskType = "HKCPIN";
        }
        if (task.getStaNo().equals("Z-LVL20")||task.getStaNo().equals("Z-LVL21")||task.getStaNo().equals("Z-LVL22")||
                task.getStaNo().equals("Z-LVL23")||task.getStaNo().equals("Z-LVL24")||task.getStaNo().equals("Z-LVL25")||
                task.getStaNo().equals("Z-LVL26")||task.getStaNo().equals("Z-LVL27")||task.getStaNo().equals("Z-LVL28")||
                task.getStaNo().equals("Z-LVL29")||task.getStaNo().equals("Z-LVL30")||task.getStaNo().equals("Z-LVL31")
        ){
            taskType = "HKCPOUT";
        }
        if (task.getIsPda() != null && task.getIsPda().equals("Y")){
            taskType = "NB1";
        }
        //AGV区域中无法用-
        String StaNo = task.getStaNo();
        String SourceStaNo = task.getSourceStaNo();
        if (task.getStaNo().split("-")[0].equals("Q")) {
            String[] split = task.getStaNo().split("-");
            StaNo = split[0]+split[1];
        }
        if (task.getSourceStaNo().split("-")[0].equals("Q")) {
            String[] split = task.getSourceStaNo().split("-");
            SourceStaNo = split[0]+split[1];
        }
        // 下发给RCS
        RcsTaskSubmit rcsTaskSubmit = new RcsTaskSubmit();
        rcsTaskSubmit.setRobotTaskCode(task.getTaskNo());
        rcsTaskSubmit.setTaskType(taskType);
        rcsTaskSubmit.setRobotTaskCode(task.getTaskNo()+"-"+task.getCtnType());
        rcsTaskSubmit.setInitPriority(10);  //默认10
        List<RcsTaskTargetRoute> targetRouteList = new ArrayList<>();
        RcsTaskTargetRoute startRoute = new RcsTaskTargetRoute();
        startRoute.setSeq(0);
        startRoute.setType(SourceStaNoType);
        startRoute.setCode(task.getSourceStaNo());
        startRoute.setCode(SourceStaNo);
        startRoute.setOperation("COLLECT");
        targetRouteList.add(startRoute);
        RcsTaskTargetRoute endRoute = new RcsTaskTargetRoute();
        endRoute.setSeq(1);
        endRoute.setType(TargetStaNoType);
        endRoute.setCode(task.getStaNo());
        endRoute.setCode(StaNo);
        endRoute.setOperation("DELIVERY");
        targetRouteList.add(endRoute);
        rcsTaskSubmit.setTargetRoute(targetRouteList);