Commit a94dc1ad by 张晓

Merge branch 'feature-dispatch-zx2' into develop

2 parents 5d7e71c4 5f79e72a
......@@ -53,7 +53,7 @@ public class PrepareController {
SolverConfig solverConfig = new SolverConfig().withSolutionClass(DispatchSolution.class);
solverConfig.withEntityClassList(Arrays.asList(Technician.class, Customer.class));// 这里不能漏掉,否则约束不生效
solverConfig.withConstraintProviderClass(DispatchConstraintProvider.class);
solverConfig.withTerminationSpentLimit(Duration.ofSeconds(10));
solverConfig.withTerminationSpentLimit(Duration.ofSeconds(60 * 5));
SolverFactory<DispatchSolution> solverFactory = SolverFactory.create(solverConfig);
solver = solverFactory.buildSolver();
......@@ -80,10 +80,10 @@ public class PrepareController {
return Result.success(resultMap);
}
// 重新进行数据准备、异步任务运行
// 重新进行数据准备、任务运行
@GetMapping("/solveStart/{groupId}/{day}")
public Result<?> solveAsync(@PathVariable String groupId, @PathVariable String day) {
log.info("调用引擎处理-异步处理, groupId:{}, day:{}", groupId, day);
log.info("调用引擎处理-处理, groupId:{}, day:{}", groupId, day);
String batchNo = batchService.buildBatchData(groupId, day);
// DispatchBatch newBatch= batchService.queryBatchInfoByDay(groupId, day);
......@@ -110,11 +110,11 @@ public class PrepareController {
solverManager.solveAndListen(problemId, id -> problem,
this.solveService::saveAndExtractSolution);
log.error("调用引擎处理-异步处理, 已触发异步, groupId:{}, batchNo:{}", groupId, batchNo);
log.error("调用引擎处理-处理, 已触发, groupId:{}, batchNo:{}", groupId, batchNo);
*/
return Result.success("已触发异步执行");
return Result.success("已触发执行");
}
@GetMapping("/solveStatus/{groupId}/{day}")
......
......@@ -55,7 +55,7 @@ public class BatchScheduler {
SolverConfig solverConfig = new SolverConfig().withSolutionClass(DispatchSolution.class);
solverConfig.withEntityClassList(Arrays.asList(Technician.class, Customer.class));// 这里不能漏掉,否则约束不生效
solverConfig.withConstraintProviderClass(DispatchConstraintProvider.class);
solverConfig.withTerminationSpentLimit(Duration.ofSeconds(20));
solverConfig.withTerminationSpentLimit(Duration.ofSeconds(60 * 5));
SolverFactory<DispatchSolution> solverFactory = SolverFactory.create(solverConfig);
solver = solverFactory.buildSolver();
......
......@@ -163,9 +163,10 @@ public class ExtractServiceImpl implements ExtractService {
} else {
// 如果有记录:1虚拟指派 2排量预派 3
if (Set.of("PRE", "VIRTUAL").contains(appointmentOpt.get().getPreStatus()) &&
Set.of("NOT_ASSIGNED", "ASSIGNED").contains(appointmentOpt.get().getStatus())) {
OrderAppointment appointment = appointmentOpt.get();
if (Set.of("PRE", "VIRTUAL").contains(appointment.getPreStatus()) &&
Set.of("NOT_ASSIGNED", "ASSIGNED").contains(appointment.getStatus())) {
String lastContent = String.format("批量自动指派:<%s,%s>", appointment.getEngineerCode(), appointment.getEngineerName());
appointment.setStatus("ASSIGNED");
appointment.setPreStatus(isConfirm ? "CONFIRM" : "PRE");
......@@ -178,6 +179,9 @@ public class ExtractServiceImpl implements ExtractService {
appointment.setExpectEndTime(dispatchOrder.getTimeEnd());
appointment.setUpdateTime(LocalDateTime.now());
orderAppointmentRepo.save(appointment);
if (null == appointment.getSuborderId()) {
appointment.setSuborderId(appointment.getOrderId());
}
OrderLog orderLog = new OrderLog().setOrderId(orderId).setSuborderId(appointment.getSuborderId()).setSource("PEA-BACKEND").setOperator("DISPATCH")
.setContent(String.format("批量自动指派:<%s,%s>", engCode, engName)).setContentOld(lastContent)
......
......@@ -40,7 +40,7 @@ class SolveServiceTest {
ExtractService extractService;
String groupId = "gsuzhou";
String day = "2023-07-11";
String day = "2023-03-20";
private SolverManager<DispatchSolution, UUID> solverManager;
private Solver<DispatchSolution> solver;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!