no message
							parent
							
								
									995e83deca
								
							
						
					
					
						commit
						6517591973
					
				| 
						 | 
				
			
			@ -1,7 +1,5 @@
 | 
			
		|||
package com.youchain.businessdata.rest;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.youchain.annotation.Log;
 | 
			
		||||
import com.youchain.annotation.AnonymousAccess;
 | 
			
		||||
import com.youchain.appupdate.inputJson.MissionStateCallback;
 | 
			
		||||
| 
						 | 
				
			
			@ -29,24 +27,15 @@ import lombok.RequiredArgsConstructor;
 | 
			
		|||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.scheduling.annotation.Async;
 | 
			
		||||
import org.springframework.scheduling.annotation.EnableAsync;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.concurrent.CompletableFuture;
 | 
			
		||||
import java.util.concurrent.ExecutionException;
 | 
			
		||||
 | 
			
		||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
 | 
			
		||||
import static org.springframework.http.HttpStatus.OK;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@RequiredArgsConstructor
 | 
			
		||||
| 
						 | 
				
			
			@ -87,36 +76,34 @@ public class KMReSController {
 | 
			
		|||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void asnTask(String id, String missionStatus) {
 | 
			
		||||
    public void asnTask(String id, String missionStatus) {
 | 
			
		||||
        //执行第一个任务后 可以继续执行第二个任务 并携带第一个任务的返回值 第二个任务执行完没有返回值
 | 
			
		||||
        AgvTaskDto agvTaskDto = agvTaskService.findById(Integer.parseInt(id));
 | 
			
		||||
        AgvTask agvTask = agvTaskService.toEntity(agvTaskDto);
 | 
			
		||||
        Task task = getFirstTask(agvTask.getId());
 | 
			
		||||
 | 
			
		||||
        if (task == null) {
 | 
			
		||||
            throw new RuntimeException("任务不存在!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        agvTaskService.agvTaskCallback(agvTask, task, missionStatus);
 | 
			
		||||
        returnMo(task.getBillCode());// 回传MO信息
 | 
			
		||||
 | 
			
		||||
        CompletableFuture<Void> returnMoFuture = CompletableFuture.runAsync(() -> {
 | 
			
		||||
            returnMo(task.getBillCode());// 回传MO信息
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void pickTask(String id, String containerCode, String missionStatus) throws Exception {
 | 
			
		||||
    public void pickTask(String id, String containerCode, String missionStatus) {
 | 
			
		||||
        if ("CANCELED".equals(missionStatus)) {
 | 
			
		||||
            cancelAgvTasks(id);
 | 
			
		||||
        } else {
 | 
			
		||||
            AgvTask agvTask = agvTaskService.findByjobCode(id, containerCode);
 | 
			
		||||
            Task task = getFirstTask(agvTask.getId());
 | 
			
		||||
 | 
			
		||||
            if (task == null) {
 | 
			
		||||
                throw new RuntimeException("任务不存在!");
 | 
			
		||||
            }
 | 
			
		||||
            returnIssue(task);// 叫料结果回传
 | 
			
		||||
            agvTaskService.agvTaskCallback(agvTask, missionStatus, containerCode);
 | 
			
		||||
 | 
			
		||||
            CompletableFuture<Void> returnIssueFuture = CompletableFuture.runAsync(() -> {
 | 
			
		||||
 | 
			
		||||
                returnIssue(task);// 叫料结果回传
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void cancelAgvTasks(String id) {
 | 
			
		||||
    public void cancelAgvTasks(String id) {
 | 
			
		||||
        List<AgvTask> agvTaskList = agvTaskService.findByjobCode(id);
 | 
			
		||||
        for (AgvTask agvTask : agvTaskList) {
 | 
			
		||||
            if (!agvTask.getStatus().equals(BizStatus.FINISH)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +114,7 @@ public class KMReSController {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Task getFirstTask(Integer agvTaskId) {
 | 
			
		||||
    public Task getFirstTask(Integer agvTaskId) {
 | 
			
		||||
        List<Task> taskList = taskRepository.getAgvTaskList(agvTaskId);
 | 
			
		||||
        return taskList.isEmpty() ? null : taskList.get(0);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,8 @@ import com.youchain.annotation.Log;
 | 
			
		|||
import com.youchain.businessdata.inputJson.*;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
 | 
			
		||||
import java.util.concurrent.ExecutionException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * MLS接口
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,6 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		|||
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.concurrent.CompletableFuture;
 | 
			
		||||
import java.util.concurrent.ExecutionException;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
| 
						 | 
				
			
			@ -330,8 +329,6 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
                batchCreateOrUpdate.batchUpdate(mosToUpdate);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -482,7 +479,7 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        CompletableFuture<Void> pickDetailFuture = inventoryFuture.runAsync(() -> {
 | 
			
		||||
        CompletableFuture<Void> pickDetailFuture = inventoryFuture.thenRun(() -> {
 | 
			
		||||
            //批量生成叫料明细
 | 
			
		||||
            if (!pickDetailToCreate.isEmpty()) {
 | 
			
		||||
                batchCreateOrUpdate.batchCreate(pickDetailToCreate);
 | 
			
		||||
| 
						 | 
				
			
			@ -503,7 +500,6 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue