Commit d9aa65fc authored by Tong Li's avatar Tong Li

设备重复

parent a87e54e4
...@@ -21,7 +21,7 @@ import java.util.stream.Collectors; ...@@ -21,7 +21,7 @@ import java.util.stream.Collectors;
public class GeneticAlgorithm { public class GeneticAlgorithm {
private final Random rnd = new Random(); private final Random rnd = new Random();
private final List<Machine> machines; private List<Machine> machines;
private final MachineSchedulerService machineScheduler; private final MachineSchedulerService machineScheduler;
private final List<Order> orders; private final List<Order> orders;
private final List<Material> materials; private final List<Material> materials;
...@@ -72,6 +72,10 @@ public class GeneticAlgorithm { ...@@ -72,6 +72,10 @@ public class GeneticAlgorithm {
materialRequirementService.init(materials, orders, allOperations, _entryRel, machineScheduler, machines,_GlobalParam); materialRequirementService.init(materials, orders, allOperations, _entryRel, machineScheduler, machines,_GlobalParam);
orderMaterials = materialRequirementService.buildMultiLevelRequirementNetwork(param.getBaseTime()); orderMaterials = materialRequirementService.buildMultiLevelRequirementNetwork(param.getBaseTime());
Set<Long> existIds = new HashSet<>();
machines=machines.stream()
.filter(t->existIds.add(t.getId()))//HashSet.add() 方法:添加成功返回 true,重复返回 false;
.collect(Collectors.toList());
} }
LocalDateTime starttime=LocalDateTime.now(); LocalDateTime starttime=LocalDateTime.now();
FileHelper.writeLogFile("排产-----------开始-----------"+allOperations.get(0).getSceneId()); FileHelper.writeLogFile("排产-----------开始-----------"+allOperations.get(0).getSceneId());
......
...@@ -166,11 +166,9 @@ if(routingIds.size()==0) ...@@ -166,11 +166,9 @@ if(routingIds.size()==0)
if (orders != null) { if (orders != null) {
orders.addAll(childorders); orders.addAll(childorders);
// _allOperations.addAll(_newEntrys); // _allOperations.addAll(_newEntrys);
Set<Long> existIds = new HashSet<>();
_Machines.addAll(_newMachines); _Machines.addAll(_newMachines);
_Machines=_Machines.stream()
.filter(t->existIds.add(t.getId()))//HashSet.add() 方法:添加成功返回 true,重复返回 false;
.collect(Collectors.toList());
} }
return allRequirements; return allRequirements;
......
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