no message
parent
745da96935
commit
995e83deca
|
|
@ -72,7 +72,7 @@ public interface LogService {
|
|||
|
||||
void saveLog(Log log);
|
||||
|
||||
void saveLogInfo(Object object, String url, String resultJson, String description, long time);
|
||||
void saveLogInfo(Object object, String url, String resultJson, String description, long time,String logType);
|
||||
|
||||
/**
|
||||
* 查询异常详情
|
||||
|
|
|
|||
|
|
@ -130,11 +130,11 @@ public class LogServiceImpl implements LogService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Async
|
||||
public void saveLogInfo(Object object,String url, String resultJson, String description, long time) {
|
||||
public void saveLogInfo(Object object,String url, String resultJson, String description, long time, String logtype) {
|
||||
// 设置日志信息
|
||||
Log log_data = new Log();
|
||||
log_data.setDescription(description);
|
||||
log_data.setLogType("INFO");
|
||||
log_data.setLogType(logtype);
|
||||
log_data.setMethod(url);
|
||||
log_data.setParams(JSON.toJSONString(object));
|
||||
log_data.setReturnData(resultJson);
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-05-09T16:31:31+0800",
|
||||
date = "2024-05-10T13:19:03+0800",
|
||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
|
||||
)
|
||||
@Component
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-05-09T16:31:31+0800",
|
||||
date = "2024-05-10T13:19:03+0800",
|
||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
|
||||
)
|
||||
@Component
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ public class PointController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> queryPointInfo(@RequestBody CurrentPage currentPage) {
|
||||
List<Point> pointList= pointService.getPoint(BaseStatus.STORAGE,"存储区",currentPage.getCurrentPage(),currentPage.getPageSize());
|
||||
int total=pointService.getPoint(BaseStatus.STORAGE,"1F存储区").size();
|
||||
int total=pointService.getPoint(BaseStatus.STORAGE,"存储区").size();
|
||||
JSONObject object=new JSONObject();
|
||||
object.put("total",total);
|
||||
object.put("data",pointList);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ 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;
|
||||
|
|
@ -41,6 +42,8 @@ import java.util.Date;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
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;
|
||||
|
|
@ -135,14 +138,12 @@ public class KMReSController {
|
|||
*
|
||||
* @param billCode
|
||||
*/
|
||||
@Async
|
||||
public void returnMo(String billCode) {
|
||||
OrderDto orderDto = orderService.findByBarcodeNumber(billCode);
|
||||
|
||||
OrderDto orderDto = orderService.findByBarcodeNumber(billCode);
|
||||
if (orderDto == null) {
|
||||
throw new RuntimeException("系统无此送货单号: " + billCode);
|
||||
}
|
||||
|
||||
double receivedQty = agvTaskService.queryBillCodeSum(billCode);
|
||||
if (receivedQty == orderDto.getDeliveryQty()) {
|
||||
List<Task> tasks = taskService.findByBillCode(billCode);
|
||||
|
|
@ -153,10 +154,10 @@ public class KMReSController {
|
|||
long endTime = System.currentTimeMillis();
|
||||
long time = endTime - startTime;
|
||||
// 保存日志
|
||||
logService.saveLogInfo(returnMoInfo, UrlApi.publicApi, resultJson, "按MO票入库", time);
|
||||
|
||||
|
||||
logService.saveLogInfo(returnMoInfo, UrlApi.publicApi, resultJson, "按MO票入库", time, "INFO");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -164,7 +165,6 @@ public class KMReSController {
|
|||
*
|
||||
* @param task
|
||||
*/
|
||||
@Async
|
||||
public void returnIssue(@RequestBody Task task) {
|
||||
|
||||
ReturnIssueInfo returnIssueInfo = getReturnIssueInfo(task);
|
||||
|
|
@ -173,7 +173,7 @@ public class KMReSController {
|
|||
long endTime = System.currentTimeMillis();
|
||||
long time = endTime - startTime;
|
||||
// 保存日志
|
||||
logService.saveLogInfo(returnIssueInfo, UrlApi.publicApi, resultJson, "叫料结果回传", time);
|
||||
logService.saveLogInfo(returnIssueInfo, UrlApi.publicApi, resultJson, "叫料结果回传", time, "INFO");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,22 +36,16 @@ public class MlsController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> getOrderInfo(@RequestBody OrderInfo orderInfo) {
|
||||
|
||||
String resultJson = "";
|
||||
try {
|
||||
resultJson = mlsService.getOrderJson(orderInfo);//获取送货单JSON
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
if (resultJson == null || resultJson.length() == 0) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
||||
} else {
|
||||
try {
|
||||
String resultJson = mlsService.getOrderJson(orderInfo);//获取送货单JSON
|
||||
if (resultJson == null || resultJson.isEmpty()) {
|
||||
return ResponseEntity.badRequest().body(ApiResult.success(BAD_REQUEST.value(), "获取送货单接口异常!", ""));
|
||||
} else {
|
||||
mlsService.getOrderInfo(resultJson);//获取送货单
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
return ResponseEntity.ok().body(ApiResult.success(OK.value(), "", resultJson));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -61,22 +55,17 @@ public class MlsController {
|
|||
@Log("获取MO票信息")
|
||||
@ApiOperation("获取MO票信息")
|
||||
public ResponseEntity<Object> getMoInfo(@RequestBody MoInfo moInfo) {
|
||||
String resultJson = "";
|
||||
try {
|
||||
resultJson = mlsService.getMoJson(moInfo);//获取Mo票JSON
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
if (resultJson == null || resultJson.length() == 0) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
||||
} else {
|
||||
try {
|
||||
try {
|
||||
String resultJson = mlsService.getMoJson(moInfo);//获取Mo票JSON
|
||||
if (resultJson == null || resultJson.isEmpty()) {
|
||||
return ResponseEntity.badRequest().body(ApiResult.success(BAD_REQUEST.value(), "获取MO票接口异常!", ""));
|
||||
} else {
|
||||
mlsService.getMoInfo(resultJson);//获取Mo票
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
return ResponseEntity.ok().body(ApiResult.success(OK.value(), "", resultJson));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +75,7 @@ public class MlsController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> returnMo(@RequestBody ReturnMoInfo returnMoInfo) {
|
||||
try {
|
||||
String resultJson = mlsService.returnMo(returnMoInfo);//回传MO票J
|
||||
String resultJson = mlsService.returnMo(returnMoInfo);//回传MO票
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ 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
|
||||
|
|
@ -145,15 +146,20 @@ public class MlsServiceImpl implements MlsService {
|
|||
ordersToCreate.add(createOrder(detail));
|
||||
}
|
||||
}
|
||||
//批量新增订单
|
||||
if (!ordersToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(ordersToCreate);
|
||||
}
|
||||
//批量更新订单
|
||||
if (!ordersToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(ordersToUpdate);
|
||||
}
|
||||
|
||||
CompletableFuture<Void> orderFutureCreate = CompletableFuture.runAsync(() -> {
|
||||
//批量新增订单
|
||||
if (!ordersToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(ordersToCreate);
|
||||
}
|
||||
});
|
||||
|
||||
CompletableFuture<Void> orderFutureUpdate = CompletableFuture.runAsync(() -> {
|
||||
//批量更新订单
|
||||
if (!ordersToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(ordersToUpdate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -311,15 +317,21 @@ public class MlsServiceImpl implements MlsService {
|
|||
}
|
||||
}
|
||||
|
||||
CompletableFuture<Void> moFutureCreate = CompletableFuture.runAsync(() -> {
|
||||
//批量新增Mo票
|
||||
if (!mosToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(mosToCreate);
|
||||
}
|
||||
});
|
||||
|
||||
CompletableFuture<Void> moFutureUpdate = CompletableFuture.runAsync(() -> {
|
||||
//批量更新Mo票
|
||||
if (!mosToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(mosToUpdate);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//批量新增Mo票
|
||||
if (!mosToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(mosToCreate);
|
||||
}
|
||||
//批量更新Mo票
|
||||
if (!mosToUpdate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchUpdate(mosToUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -391,7 +403,6 @@ public class MlsServiceImpl implements MlsService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void getIssueInfo(IssueInfo issueInfo) {
|
||||
String taskNumber = issueInfo.getTaskNumber();//任务号
|
||||
// 指定Set的类型
|
||||
|
|
@ -412,8 +423,8 @@ public class MlsServiceImpl implements MlsService {
|
|||
|
||||
List<Inventory> inventoryToUpdate = new ArrayList<>();
|
||||
List<PickDetail> pickDetailToCreate = new ArrayList<>();
|
||||
List<Task> taskToCreate = new ArrayList<>();
|
||||
List<AgvTask> agvTaskToCreate = new ArrayList<>();
|
||||
List<Task> taskToCreate = new ArrayList<>();
|
||||
|
||||
for (Inventory inv : inventoryList) {
|
||||
//根据库存信息生成叫料任务
|
||||
|
|
@ -471,31 +482,27 @@ public class MlsServiceImpl implements MlsService {
|
|||
});
|
||||
|
||||
|
||||
CompletableFuture<Void> pickDetailFuture = CompletableFuture.runAsync(() -> {
|
||||
CompletableFuture<Void> pickDetailFuture = inventoryFuture.runAsync(() -> {
|
||||
//批量生成叫料明细
|
||||
if (!pickDetailToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(pickDetailToCreate);
|
||||
}
|
||||
});
|
||||
|
||||
CompletableFuture<Void> agvTaskFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量生成agv任务
|
||||
CompletableFuture<Void> agvTaskFuture = pickDetailFuture.thenRun(() -> {
|
||||
// 批量生成agv任务
|
||||
if (!agvTaskToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(agvTaskToCreate);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
CompletableFuture<Void> taskFuture = CompletableFuture.runAsync(() -> {
|
||||
//批量生成任务
|
||||
CompletableFuture<Void> taskFuture = agvTaskFuture.thenRun(() -> {
|
||||
// 批量生成任务
|
||||
if (!taskToCreate.isEmpty()) {
|
||||
batchCreateOrUpdate.batchCreate(taskToCreate);
|
||||
}
|
||||
});
|
||||
inventoryFuture.join();
|
||||
pickDetailFuture.join();
|
||||
agvTaskFuture.join();
|
||||
taskFuture.join();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class moTask {
|
|||
mlsService.getMoInfo(resultJson);
|
||||
long time = System.currentTimeMillis() - startTime;
|
||||
// 保存日志
|
||||
logService.saveLogInfo(moInfo, UrlApi.publicApi, resultJson, "获取MO票信息", time);
|
||||
logService.saveLogInfo(moInfo, UrlApi.publicApi, resultJson, "获取MO票信息", time,"INFO");
|
||||
}
|
||||
|
||||
public MoInfo getMoInfo() {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class orderTask {
|
|||
mlsService.getOrderInfo(resultJson);
|
||||
long time = System.currentTimeMillis() - startTime;
|
||||
// 保存日志
|
||||
logService.saveLogInfo(orderInfo, UrlApi.publicApi, resultJson, "获取送货单信息", time);
|
||||
logService.saveLogInfo(orderInfo, UrlApi.publicApi, resultJson, "获取送货单信息", time,"INFO");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package com.youchain.utils;
|
||||
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import java.util.List;
|
||||
|
|
@ -21,7 +19,6 @@ public class BatchCreateOrUpdate {
|
|||
* @param <T> 实体类型
|
||||
*/
|
||||
@Transactional
|
||||
@Async
|
||||
public <T> void batchCreate(List<T> entities) {
|
||||
int batchSize = 100;
|
||||
if (entities == null || entities.isEmpty()) {
|
||||
|
|
@ -46,6 +43,7 @@ public class BatchCreateOrUpdate {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量更新实体。
|
||||
*
|
||||
|
|
@ -53,7 +51,6 @@ public class BatchCreateOrUpdate {
|
|||
* @param <T> 实体类型
|
||||
*/
|
||||
@Transactional
|
||||
@Async
|
||||
public <T> void batchUpdate(List<T> entities) {
|
||||
int batchSize = 100;
|
||||
if (entities == null || entities.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue