no message
parent
56883489ca
commit
f3a9395e7f
|
|
@ -65,7 +65,7 @@ public class Task extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "任务类型")
|
@ApiModelProperty(value = "任务类型")
|
||||||
private String taskType;
|
private String taskType;
|
||||||
|
|
||||||
@OneToOne(cascade = CascadeType.PERSIST)
|
@OneToOne
|
||||||
@JoinColumn(name = "asn_detail_id")
|
@JoinColumn(name = "asn_detail_id")
|
||||||
@ApiModelProperty(value = "收货明细序号")
|
@ApiModelProperty(value = "收货明细序号")
|
||||||
private AsnDetail asnDetail;
|
private AsnDetail asnDetail;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class MlsController {
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
@Log("叫料指令")
|
@Log("叫料指令")
|
||||||
@ApiOperation("叫料指令")
|
@ApiOperation("叫料指令")
|
||||||
public synchronized ResponseEntity<Object> getIssueInfo(@RequestBody IssueInfo issueInfo) {
|
public ResponseEntity<Object> getIssueInfo(@RequestBody IssueInfo issueInfo) {
|
||||||
/*try {
|
/*try {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.businessdata.domain.*;
|
import com.youchain.businessdata.domain.*;
|
||||||
import com.youchain.businessdata.inputJson.*;
|
import com.youchain.businessdata.inputJson.*;
|
||||||
import com.youchain.businessdata.service.*;
|
import com.youchain.businessdata.service.*;
|
||||||
|
import com.youchain.config.thread.ThreadPoolExecutorUtil;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import com.youchain.modules.system.service.DeptService;
|
import com.youchain.modules.system.service.DeptService;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
|
|
@ -24,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -472,41 +474,44 @@ public class MlsServiceImpl implements MlsService {
|
||||||
taskToCreate.add(task);
|
taskToCreate.add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutorService executor = ThreadPoolExecutorUtil.getPoll("getIssueInfo-job");
|
||||||
|
|
||||||
|
// 批量更新库存信息
|
||||||
CompletableFuture<Void> inventoryFuture = CompletableFuture.runAsync(() -> {
|
CompletableFuture<Void> inventoryFuture = CompletableFuture.runAsync(() -> {
|
||||||
//批量更新库存信息
|
//批量更新库存信息
|
||||||
if (!inventoryToUpdate.isEmpty()) {
|
if (!inventoryToUpdate.isEmpty()) {
|
||||||
batchCreateOrUpdate.batchUpdate(inventoryToUpdate);
|
batchCreateOrUpdate.batchUpdate(inventoryToUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}, executor);
|
||||||
|
|
||||||
|
|
||||||
CompletableFuture<Void> pickDetailFuture = inventoryFuture.thenAccept(result2 -> {
|
CompletableFuture<Void> pickDetailFuture = inventoryFuture.thenRunAsync(() -> {
|
||||||
//批量生成叫料明细
|
//批量生成叫料明细
|
||||||
if (!pickDetailToCreate.isEmpty()) {
|
if (!pickDetailToCreate.isEmpty()) {
|
||||||
batchCreateOrUpdate.batchCreate(pickDetailToCreate);
|
batchCreateOrUpdate.batchCreate(pickDetailToCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}, executor);
|
||||||
|
|
||||||
CompletableFuture<Void> agvTaskFuture = pickDetailFuture.thenAccept(result3 -> {
|
CompletableFuture<Void> agvTaskFuture = pickDetailFuture.thenRunAsync(() -> {
|
||||||
// 批量生成agv任务
|
// 批量生成agv任务
|
||||||
if (!agvTaskToCreate.isEmpty()) {
|
if (!agvTaskToCreate.isEmpty()) {
|
||||||
batchCreateOrUpdate.batchCreate(agvTaskToCreate);
|
batchCreateOrUpdate.batchCreate(agvTaskToCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}, executor);
|
||||||
|
|
||||||
CompletableFuture<Void> taskFuture = agvTaskFuture.thenAccept(result4 -> {
|
CompletableFuture<Void> taskFuture = agvTaskFuture.thenRunAsync(() -> {
|
||||||
// 批量生成任务
|
// 批量生成任务
|
||||||
if (!taskToCreate.isEmpty()) {
|
if (!taskToCreate.isEmpty()) {
|
||||||
batchCreateOrUpdate.batchCreate(taskToCreate);
|
batchCreateOrUpdate.batchCreate(taskToCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}, executor);
|
||||||
|
taskFuture.join();
|
||||||
CompletableFuture.allOf(inventoryFuture, pickDetailFuture, agvTaskFuture, taskFuture).join();
|
|
||||||
|
|
||||||
|
executor.shutdown();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.youchain.utils;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -18,7 +19,7 @@ public class BatchCreateOrUpdate {
|
||||||
* @param entities 要插入的实体列表
|
* @param entities 要插入的实体列表
|
||||||
* @param <T> 实体类型
|
* @param <T> 实体类型
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public <T> void batchCreate(List<T> entities) {
|
public <T> void batchCreate(List<T> entities) {
|
||||||
int batchSize = 100;
|
int batchSize = 100;
|
||||||
if (entities == null || entities.isEmpty()) {
|
if (entities == null || entities.isEmpty()) {
|
||||||
|
|
@ -50,7 +51,7 @@ public class BatchCreateOrUpdate {
|
||||||
* @param entities 要更新的实体列表
|
* @param entities 要更新的实体列表
|
||||||
* @param <T> 实体类型
|
* @param <T> 实体类型
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public <T> void batchUpdate(List<T> entities) {
|
public <T> void batchUpdate(List<T> entities) {
|
||||||
int batchSize = 100;
|
int batchSize = 100;
|
||||||
if (entities == null || entities.isEmpty()) {
|
if (entities == null || entities.isEmpty()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue