返回数据修改

parent bdb0cf2b
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<groupId>com.aps</groupId> <groupId>com.aps</groupId>
<artifactId>java-test</artifactId> <artifactId>aps</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>demo2</name> <name>demo2</name>
<description>demo2</description> <description>demo2</description>
......
...@@ -66299,3 +66299,35 @@ ...@@ -66299,3 +66299,35 @@
[87000-99000]:[11-02 00:10-11-02 03:30] 12000 [87000-99000]:[11-02 00:10-11-02 03:30] 12000
[113400-137400]:[11-02 07:30-11-02 14:10] 24000 [113400-137400]:[11-02 07:30-11-02 14:10] 24000
[2025-12-16 11:49:14] [2025-12-16 11:49:14]
[2025-12-18 15:55:53]
=== Schedule Summary === 0.484233
[2025-12-18 15:55:53] Operation: 1|2|1|2|1|2|1|2|1|2
[2025-12-18 15:55:53] Makespan: 283800.000000 minutes
[2025-12-18 15:55:53] Total Tardiness: 0.000000 hours
[2025-12-18 15:55:53] Setup Time: 0.000000 minutes
[2025-12-18 15:55:53] Flow Time: 93060.000000 minutes
[2025-12-18 15:55:53] Machine Load Balance: 99.33%
[2025-12-18 15:55:53] -------------------------
[2025-12-18 15:55:53] [171060-212520]:[11-02 23:31-11-03 11:02] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[171060-199740]:[11-02 23:31-11-03 07:29] 28680
[205200-212520]:[11-03 09:00-11-03 11:02] 7320
[2025-12-18 15:55:53] [235800-241800]:[11-03 17:30-11-03 19:10] Order 1, Machine 3243, Operation 2, Batch 5000.0, processingTime %.1f
[235800-241800]:[11-03 17:30-11-03 19:10] 6000
[2025-12-18 15:55:53] [271800-277800]:[11-04 03:30-11-04 05:10] Order 1, Machine 3243, Operation 4, Batch 5000.0, processingTime %.1f
[271800-277800]:[11-04 03:30-11-04 05:10] 6000
[2025-12-18 15:55:53] [259800-265800]:[11-04 00:10-11-04 01:50] Order 1, Machine 3243, Operation 5, Batch 5000.0, processingTime %.1f
[259800-265800]:[11-04 00:10-11-04 01:50] 6000
[2025-12-18 15:55:53] [247800-253800]:[11-03 20:50-11-03 22:30] Order 1, Machine 3243, Operation 6, Batch 5000.0, processingTime %.1f
[247800-253800]:[11-03 20:50-11-03 22:30] 6000
[2025-12-18 15:55:53]
[2025-12-18 15:55:53] [212520-216120]:[11-03 11:02-11-03 12:02] Order 2, Machine 3403, Operation 7, Batch 5000.0, processingTime %.1f
[212520-216120]:[11-03 11:02-11-03 12:02] 3600
[2025-12-18 15:55:53] [241800-247800]:[11-03 19:10-11-03 20:50] Order 2, Machine 3243, Operation 8, Batch 5000.0, processingTime %.1f
[241800-247800]:[11-03 19:10-11-03 20:50] 6000
[2025-12-18 15:55:53] [253800-259800]:[11-03 22:30-11-04 00:10] Order 2, Machine 3243, Operation 9, Batch 5000.0, processingTime %.1f
[253800-259800]:[11-03 22:30-11-04 00:10] 6000
[2025-12-18 15:55:53] [265800-271800]:[11-04 01:50-11-04 03:30] Order 2, Machine 3243, Operation 10, Batch 5000.0, processingTime %.1f
[265800-271800]:[11-04 01:50-11-04 03:30] 6000
[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]
...@@ -41,8 +41,14 @@ public class GeneticDecoder { ...@@ -41,8 +41,14 @@ public class GeneticDecoder {
private List<OrderMaterialRequirement> orderMaterials; private List<OrderMaterialRequirement> orderMaterials;
// 添加静态实例引用
private static DiscreteParameterMatrixService staticDiscreteParameterMatrixService;
// 设置静态服务实例的方法
public static void setDiscreteParameterMatrixService(DiscreteParameterMatrixService service) {
staticDiscreteParameterMatrixService = service;
}
private DiscreteParameterMatrixService discreteParameterMatrixService;
public GeneticDecoder(GlobalParam globalParam,LocalDateTime baseTime, List<Machine> machines, List<Order> orders, public GeneticDecoder(GlobalParam globalParam,LocalDateTime baseTime, List<Machine> machines, List<Order> orders,
List<Material> materials, MachineSchedulerService machineScheduler, List<OrderMaterialRequirement> _orderMaterials) { List<Material> materials, MachineSchedulerService machineScheduler, List<OrderMaterialRequirement> _orderMaterials) {
this.baseTime = baseTime; this.baseTime = baseTime;
...@@ -819,13 +825,12 @@ public class GeneticDecoder { ...@@ -819,13 +825,12 @@ public class GeneticDecoder {
//离散参数 //离散参数
// prev.getDiscreteParameter() // prev.getDiscreteParameter()
setupTime = (prev.getProductId() != operation.getProductId())
? (int) discreteParameterMatrixService.getDiscreteParameterMatrixValue(prev, operation)
: 0;
if (setupTime > 0) { if (staticDiscreteParameterMatrixService != null) {
System.out.println("设备 " + machine.getId() + " 需要换型,因为产品从 " + prev.getProductId() + " 变更为 " + operation.getProductId()); setupTime = (int) staticDiscreteParameterMatrixService.getDiscreteParameterMatrixValue(prev, operation);
} else {
// 添加兜底处理,避免空指针异常
setupTime = 0;
} }
} }
......
...@@ -35,7 +35,7 @@ public class PlanResultServiceTest { ...@@ -35,7 +35,7 @@ public class PlanResultServiceTest {
public void testExecute2() { public void testExecute2() {
// 这里需要一个有效的SceneId来测试 // 这里需要一个有效的SceneId来测试
// 在实际测试中,您需要提供一个数据库中存在的SceneId // 在实际测试中,您需要提供一个数据库中存在的SceneId
String sceneId = "2BD38C14EDAD4CBFB8C9671CD45437A6"; String sceneId = "2605077DA8D84D2E9380EDB67A448C5C";
try { try {
// Chromosome result = planResultService.execute2(sceneId); // Chromosome result = planResultService.execute2(sceneId);
...@@ -57,16 +57,22 @@ public class PlanResultServiceTest { ...@@ -57,16 +57,22 @@ public class PlanResultServiceTest {
//planResultService.SpiltOrder(sceneId,"2f24e563-1337-422b-a0ba-92da7e8c6584",splitCounts.toArray(new Double[0])); //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.schedule(sceneId);
Chromosome schedule = sceneService.loadChromosomeFromFile(sceneId);
// 转换为 ProductGanttVO 格式 planResultService.SpiltOrder(sceneId,"2f24e563-1337-422b-a0ba-92da7e8c6584",splitCountsArray);
List<ProductGanttVO> productGanttVOList= new ArrayList<>();
List<ProductGanttVO> resourceGanttVOs = planResultService.convertToProductGanttVO1(schedule);
productGanttVOList.addAll(resourceGanttVOs);
System.out.println("执行成功,结果:" + (productGanttVOList != null ? "获得染色体对象" : "空结果")); // planResultService.schedule(sceneId);
// Chromosome schedule = sceneService.loadChromosomeFromFile(sceneId);
//
// // 转换为 ProductGanttVO 格式
// List<ProductGanttVO> productGanttVOList= new ArrayList<>();
// List<ProductGanttVO> resourceGanttVOs = planResultService.convertToProductGanttVO1(schedule);
// productGanttVOList.addAll(resourceGanttVOs);
//
// System.out.println("执行成功,结果:" + (productGanttVOList != null ? "获得染色体对象" : "空结果"));
......
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