返回数据修改

parent 25512e9d
......@@ -66331,3 +66331,128 @@
[2025-12-18 15:55:53] [277800-283800]:[11-04 05:10-11-04 06:50] Order 2, Machine 3243, Operation 11, Batch 5000.0, processingTime %.1f
[277800-283800]:[11-04 05:10-11-04 06:50] 6000
[2025-12-18 15:55:53]
[2025-12-18 16:07:03]
=== Schedule Summary === 0.484233
[2025-12-18 16:07:03] Operation: 1|3|2|1|3|2|1|3|2|1|3|2|1|3|2
[2025-12-18 16:07:03] Makespan: 735720.000000 minutes
[2025-12-18 16:07:03] Total Tardiness: 0.000000 hours
[2025-12-18 16:07:03] Setup Time: 0.000000 minutes
[2025-12-18 16:07:03] Flow Time: 529200.000000 minutes
[2025-12-18 16:07:03] Machine Load Balance: 96.30%
[2025-12-18 16:07:03] -------------------------
[2025-12-18 16:07:03] [216120-306120]:[11-03 12:02-11-04 13:02] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[216120-237600]:[11-03 12:02-11-03 18:00] 21480
[291600-306120]:[11-04 09:00-11-04 13:02] 14520
[2025-12-18 16:07:03] [306120-312120]:[11-04 13:02-11-04 14:42] Order 1, Machine 3243, Operation 2, Batch 5000.0, processingTime %.1f
[306120-312120]:[11-04 13:02-11-04 14:42] 6000
[2025-12-18 16:07:03] [649320-655320]:[11-08 12:22-11-08 14:02] Order 1, Machine 3243, Operation 4, Batch 5000.0, processingTime %.1f
[649320-655320]:[11-08 12:22-11-08 14:02] 6000
[2025-12-18 16:07:03] [562920-568920]:[11-07 12:22-11-07 14:02] Order 1, Machine 3243, Operation 5, Batch 5000.0, processingTime %.1f
[562920-568920]:[11-07 12:22-11-07 14:02] 6000
[2025-12-18 16:07:03] [476520-482520]:[11-06 12:22-11-06 14:02] Order 1, Machine 3243, Operation 6, Batch 5000.0, processingTime %.1f
[476520-482520]:[11-06 12:22-11-06 14:02] 6000
[2025-12-18 16:07:03]
[2025-12-18 16:07:03] [396120-399720]:[11-05 14:02-11-05 15:02] Order 2, Machine 3403, Operation 7, Batch 5000.0, processingTime %.1f
[396120-399720]:[11-05 14:02-11-05 15:02] 3600
[2025-12-18 16:07:03] [470520-476520]:[11-06 10:42-11-06 12:22] Order 2, Machine 3243, Operation 8, Batch 5000.0, processingTime %.1f
[470520-476520]:[11-06 10:42-11-06 12:22] 6000
[2025-12-18 16:07:03] [556920-562920]:[11-07 10:42-11-07 12:22] Order 2, Machine 3243, Operation 9, Batch 5000.0, processingTime %.1f
[556920-562920]:[11-07 10:42-11-07 12:22] 6000
[2025-12-18 16:07:03] [643320-649320]:[11-08 10:42-11-08 12:22] Order 2, Machine 3243, Operation 10, Batch 5000.0, processingTime %.1f
[643320-649320]:[11-08 10:42-11-08 12:22] 6000
[2025-12-18 16:07:03] [729720-735720]:[11-09 10:42-11-09 12:22] Order 2, Machine 3243, Operation 11, Batch 5000.0, processingTime %.1f
[729720-735720]:[11-09 10:42-11-09 12:22] 6000
[2025-12-18 16:07:03]
[2025-12-18 16:07:03] [306120-396120]:[11-04 13:02-11-05 14:02] Order 3, Machine 3403, Operation 12, Batch 50000.0, processingTime %.1f
[306120-324000]:[11-04 13:02-11-04 18:00] 17880
[378000-396120]:[11-05 09:00-11-05 14:02] 18120
[2025-12-18 16:07:03] [396120-470520]:[11-05 14:02-11-06 10:42] Order 3, Machine 3243, Operation 13, Batch 50000.0, processingTime %.1f
[396120-444600]:[11-05 14:02-11-06 03:30] 48480
[459000-470520]:[11-06 07:30-11-06 10:42] 11520
[2025-12-18 16:07:03] [482520-556920]:[11-06 14:02-11-07 10:42] Order 3, Machine 3243, Operation 14, Batch 50000.0, processingTime %.1f
[482520-531000]:[11-06 14:02-11-07 03:30] 48480
[545400-556920]:[11-07 07:30-11-07 10:42] 11520
[2025-12-18 16:07:03] [568920-643320]:[11-07 14:02-11-08 10:42] Order 3, Machine 3243, Operation 15, Batch 50000.0, processingTime %.1f
[568920-617400]:[11-07 14:02-11-08 03:30] 48480
[631800-643320]:[11-08 07:30-11-08 10:42] 11520
[2025-12-18 16:07:03] [655320-729720]:[11-08 14:02-11-09 10:42] Order 3, Machine 3243, Operation 16, Batch 50000.0, processingTime %.1f
[655320-703800]:[11-08 14:02-11-09 03:30] 48480
[718200-729720]:[11-09 07:30-11-09 10:42] 11520
[2025-12-18 16:07:03]
[2025-12-18 16:49:34]
=== Schedule Summary === 0.484233
[2025-12-18 16:49:34] Operation: 3|2|3|2|3|2|3|2|3|2
[2025-12-18 16:49:34] Makespan: 1028580.000000 minutes
[2025-12-18 16:49:34] Total Tardiness: 0.000000 hours
[2025-12-18 16:49:34] Setup Time: 0.000000 minutes
[2025-12-18 16:49:34] Flow Time: 386460.000000 minutes
[2025-12-18 16:49:34] Machine Load Balance: 98.67%
[2025-12-18 16:49:34] -------------------------
[2025-12-18 16:49:34] [489720-493320]:[11-06 16:02-11-06 17:02] Order 2, Machine 3403, Operation 7, Batch 5000.0, processingTime %.1f
[489720-493320]:[11-06 16:02-11-06 17:02] 3600
[2025-12-18 16:49:34] [810120-816120]:[11-10 09:02-11-10 10:42] Order 2, Machine 3243, Operation 8, Batch 5000.0, processingTime %.1f
[810120-816120]:[11-10 09:02-11-10 10:42] 6000
[2025-12-18 16:49:34] [876120-882120]:[11-11 03:22-11-11 05:02] Order 2, Machine 3243, Operation 9, Batch 5000.0, processingTime %.1f
[876120-882120]:[11-11 03:22-11-11 05:02] 6000
[2025-12-18 16:49:34] [942180-948180]:[11-11 21:43-11-11 23:23] Order 2, Machine 3243, Operation 10, Batch 5000.0, processingTime %.1f
[942180-948180]:[11-11 21:43-11-11 23:23] 6000
[2025-12-18 16:49:34] [1022580-1028580]:[11-12 20:03-11-12 21:43] Order 2, Machine 3243, Operation 11, Batch 5000.0, processingTime %.1f
[1022580-1028580]:[11-12 20:03-11-12 21:43] 6000
[2025-12-18 16:49:34]
[2025-12-18 16:49:34] [399720-489720]:[11-05 15:02-11-06 16:02] Order 3, Machine 3403, Operation 12, Batch 50000.0, processingTime %.1f
[399720-410400]:[11-05 15:02-11-05 18:00] 10680
[464400-489720]:[11-06 09:00-11-06 16:02] 25320
[2025-12-18 16:49:34] [735720-810120]:[11-09 12:22-11-10 09:02] Order 3, Machine 3243, Operation 13, Batch 50000.0, processingTime %.1f
[735720-790200]:[11-09 12:22-11-10 03:30] 54480
[804600-810120]:[11-10 07:30-11-10 09:02] 5520
[2025-12-18 16:49:34] [816120-876120]:[11-10 10:42-11-11 03:22] Order 3, Machine 3243, Operation 14, Batch 50000.0, processingTime %.1f
[816120-876120]:[11-10 10:42-11-11 03:22] 60000
[2025-12-18 16:49:34] [882120-942180]:[11-11 05:02-11-11 21:43] Order 3, Machine 3243, Operation 15, Batch 50000.0, processingTime %.1f
[882120-890940]:[11-11 05:02-11-11 07:29] 8820
[891000-942180]:[11-11 07:30-11-11 21:43] 51180
[2025-12-18 16:49:34] [948180-1022580]:[11-11 23:23-11-12 20:03] Order 3, Machine 3243, Operation 16, Batch 50000.0, processingTime %.1f
[948180-963000]:[11-11 23:23-11-12 03:30] 14820
[977400-1022580]:[11-12 07:30-11-12 20:03] 45180
[2025-12-18 16:49:34]
[2025-12-18 16:53:05]
=== Schedule Summary === 0.484233
[2025-12-18 16:53:05] Operation: 2|2|2|2|2
[2025-12-18 16:53:05] Makespan: 1090980.000000 minutes
[2025-12-18 16:53:05] Total Tardiness: 0.000000 hours
[2025-12-18 16:53:05] Setup Time: 0.000000 minutes
[2025-12-18 16:53:05] Flow Time: 123600.000000 minutes
[2025-12-18 16:53:05] Machine Load Balance: 99.92%
[2025-12-18 16:53:05] -------------------------
[2025-12-18 16:53:05] [493320-554520]:[11-06 17:02-11-07 10:02] Order 2, Machine 3403, Operation 7, Batch 10000.0, processingTime %.1f
[493320-496800]:[11-06 17:02-11-06 18:00] 3480
[550800-554520]:[11-07 09:00-11-07 10:02] 3720
[2025-12-18 16:53:05] [1028580-1040580]:[11-12 21:43-11-13 01:03] Order 2, Machine 3243, Operation 8, Batch 10000.0, processingTime %.1f
[1028580-1040580]:[11-12 21:43-11-13 01:03] 12000
[2025-12-18 16:53:05] [1040580-1066980]:[11-13 01:03-11-13 08:23] Order 2, Machine 3243, Operation 9, Batch 10000.0, processingTime %.1f
[1040580-1049400]:[11-13 01:03-11-13 03:30] 8820
[1063800-1066980]:[11-13 07:30-11-13 08:23] 3180
[2025-12-18 16:53:05] [1066980-1078980]:[11-13 08:23-11-13 11:43] Order 2, Machine 3243, Operation 10, Batch 10000.0, processingTime %.1f
[1066980-1078980]:[11-13 08:23-11-13 11:43] 12000
[2025-12-18 16:53:05] [1078980-1090980]:[11-13 11:43-11-13 15:03] Order 2, Machine 3243, Operation 11, Batch 10000.0, processingTime %.1f
[1078980-1090980]:[11-13 11:43-11-13 15:03] 12000
[2025-12-18 16:53:05]
[2025-12-18 17:40:09]
=== Schedule Summary === 0.484233
[2025-12-18 17:40:09] Operation: 1|2|1|2
[2025-12-18 17:40:09] Makespan: 223800.000000 minutes
[2025-12-18 17:40:09] Total Tardiness: 0.000000 hours
[2025-12-18 17:40:09] Setup Time: 0.000000 minutes
[2025-12-18 17:40:09] Flow Time: 206400.000000 minutes
[2025-12-18 17:40:09] Machine Load Balance: 94.08%
[2025-12-18 17:40:09] -------------------------
[2025-12-18 17:40:09] [27000-63000]:[11-01 07:30-11-01 17:30] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[2025-12-18 17:40:09] [27000-87000]:[11-01 07:30-11-02 00:10] Order 1, Machine 3401, Operation 2, Batch 50000.0, processingTime %.1f
[27000-87000]:[11-01 07:30-11-02 00:10] 60000
[2025-12-18 17:40:09]
[2025-12-18 17:40:09] [113400-149400]:[11-02 07:30-11-02 17:30] Order 2, Machine 3403, Operation 3, Batch 50000.0, processingTime %.1f
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-18 17:40:09] [149400-223800]:[11-02 17:30-11-03 14:10] Order 2, Machine 3401, Operation 4, Batch 50000.0, processingTime %.1f
[149400-185400]:[11-02 17:30-11-03 03:30] 36000
[199800-223800]:[11-03 07:30-11-03 14:10] 24000
[2025-12-18 17:40:09]
......@@ -75,10 +75,36 @@ public class ProductionDeepCopyUtil {
}
try {
// 如果列表为空,我们无法推断类型,但仍然需要保持原来的类型信息
if (source.isEmpty()) {
// 返回一个新的空列表,保持相同的运行时类型
return new ArrayList<>();
}
// 获取列表元素的类型
Class<?> elementType = source.get(0).getClass();
// 构造正确的集合类型信息
String json = objectMapper.writeValueAsString(source);
return objectMapper.readValue(json,
objectMapper.getTypeFactory().constructCollectionType(List.class,
source.isEmpty() ? Object.class : source.get(0).getClass()));
objectMapper.getTypeFactory().constructCollectionType(List.class, elementType));
} catch (Exception e) {
throw new RuntimeException("列表深拷贝失败", e);
}
}
/**
* 带指定元素类型的列表深拷贝
*/
public static <T> List<T> deepCopyList(List<T> source, Class<T> elementType) {
if (source == null) {
return new ArrayList<>();
}
try {
String json = objectMapper.writeValueAsString(source);
return objectMapper.readValue(json,
objectMapper.getTypeFactory().constructCollectionType(List.class, elementType));
} catch (Exception e) {
throw new RuntimeException("列表深拷贝失败", e);
}
......
......@@ -219,7 +219,7 @@ public class ResourceGanttController {
return R.ok("删除成功");
}
@PostMapping("/orderdel")
@PostMapping("/orderDel")
@Operation(summary = "删除订单", description = "删除订单")
public R<Chromosome> delOrder(@RequestBody Map<String, Object> params) {
log.info("delOperation 请求参数: {}", params);
......
......@@ -84,7 +84,7 @@ public class GeneticDecoder {
chromosome.setTotalChangeoverTime(cachedResult.getTotalChangeoverTime());
chromosome.setMachineLoadStd(cachedResult.getMachineLoadStd());
chromosome.setDelayTime(cachedResult.getDelayTime());
chromosome.setResult(ProductionDeepCopyUtil.deepCopy(cachedResult.getResult()));
chromosome.setResult(ProductionDeepCopyUtil.deepCopyList(cachedResult.getResult(), GAScheduleResult.class));
// Chromosome chromosomen= ProductionDeepCopyUtil.deepCopy(cachedResult);
return chromosome;
......@@ -364,8 +364,7 @@ public class GeneticDecoder {
int preTime = machineOption.getPreTime();
int setupTime = calculateSetupTime(chromosome.getResult(), operation, machine, machineOption);
System.out.println(" 处理时间: " + processingTime + ", 后处理: " + teardownTime +
", 前处理: " + preTime + ", 换型: " + setupTime);
// 确定任务的最早开始时间(基于前一道工序的完整结束时间,包含后处理)
......@@ -405,21 +404,16 @@ public class GeneticDecoder {
earliestStartTime = Math.max(earliestStartTime, machineAvailableTime);
}
System.out.println(" 最终最早开始时间: " + earliestStartTime +
" (前序工序结束含后处理: " + prevOperationEndTime + ", 设备可用: " +
(lastGeneOnMachine != null ? lastGeneOnMachine.getEndTime() : 0) +
", 换型: " + setupTime + ")");
// 根据换型模式调整处理时间
// int processingTimeForScheduling;
if (_globalParam.is_smoothSetup()) {
// 平滑模式:只需要安排主处理时间
// processingTimeForScheduling = processingTimeTotal;
System.out.println(" 平滑模式:安排主处理时间 " + processingTime + " 分钟");
} else {
// 标准模式:需要安排主处理时间+换型时间
processingTimeTotal = processingTimeTotal + setupTime;
System.out.println(" 标准模式:安排主处理+" + setupTime + "分钟换型=" + processingTimeTotal + "分钟");
}
GAScheduleResult existingResult = chromosome.getResultOld().stream().filter(r-> r.getOperationId() == operation.Id).findFirst().orElse(null);
......@@ -813,7 +807,6 @@ public class GeneticDecoder {
.orElse(null);
if (lastGeneOnMachine == null) {
System.out.println("设备 " + machine.getId() + " 上无历史任务,换型时间为0");
return 0;
}
Entry prev= _allOperations.stream().
......
......@@ -68,10 +68,13 @@ public class RoutingDataService {
.collect(Collectors.toList());
// 查询RoutingDiscreteParam中routingDetailId在上述列表中的所有记录
List<RoutingDiscreteParam> routingDiscreteParams = _routingDiscreteParamService.lambdaQuery()
.in(RoutingDiscreteParam::getRoutingDetailId, routingDetailIds)
.eq(RoutingDiscreteParam::getIsDeleted, 0)
.list();
List<RoutingDiscreteParam> routingDiscreteParams = new ArrayList<>();
if (!routingDetailIds.isEmpty()) {
routingDiscreteParams = _routingDiscreteParamService.lambdaQuery()
.in(RoutingDiscreteParam::getRoutingDetailId, routingDetailIds)
.eq(RoutingDiscreteParam::getIsDeleted, 0)
.list();
}
List<ProdOrderProcess> ProdOrderProcesss = _prodOrderProcessService.lambdaQuery()
......
......@@ -35,7 +35,7 @@ public class PlanResultServiceTest {
public void testExecute2() {
// 这里需要一个有效的SceneId来测试
// 在实际测试中,您需要提供一个数据库中存在的SceneId
String sceneId = "2605077DA8D84D2E9380EDB67A448C5C";
String sceneId = "E9C72513F48D44188C7989EEAEE85D3E";
try {
// Chromosome result = planResultService.execute2(sceneId);
......@@ -57,15 +57,15 @@ public class PlanResultServiceTest {
//planResultService.SpiltOrder(sceneId,"2f24e563-1337-422b-a0ba-92da7e8c6584",splitCounts.toArray(new Double[0]));
Double[] splitCountsArray = new Double[2]; // 创建一个空的Double数组,可以根据实际需求调整大小或初始化值
splitCountsArray[0] = 0.0;
splitCountsArray[1] = 5000.0;
planResultService.SpiltOrder(sceneId,"2f24e563-1337-422b-a0ba-92da7e8c6584",splitCountsArray);
// Double[] splitCountsArray = new Double[2]; // 创建一个空的Double数组,可以根据实际需求调整大小或初始化值
// splitCountsArray[0] = 0.0;
// splitCountsArray[1] = 5000.0;
//
//
// planResultService.SpiltOrder(sceneId,"2f24e563-1337-422b-a0ba-92da7e8c6584",splitCountsArray);
// planResultService.schedule(sceneId);
// Chromosome schedule = sceneService.loadChromosomeFromFile(sceneId);
planResultService.schedule(sceneId);
Chromosome schedule = sceneService.loadChromosomeFromFile(sceneId);
//
// // 转换为 ProductGanttVO 格式
// List<ProductGanttVO> productGanttVOList= new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment