Commit 8fa4eff6 authored by Tong Li's avatar Tong Li

bom

parent 159ecfb7
...@@ -27,20 +27,20 @@ public class Entry { ...@@ -27,20 +27,20 @@ public class Entry {
/** /**
* 基因编号 * 基因编号
*/ */
public int id ; private int id ;
/** /**
* 所属组ID 需要按照前后顺序生产的工单给一组 * 所属组ID 需要按照前后顺序生产的工单给一组
*/ */
public int GroupId ; private int groupId ;
/** /**
* 原订单ID * 原订单ID
*/ */
public String OrderId ; private String orderId ;
public String OrderCode ; private String orderCode ;
public String SceneId ; private String sceneId ;
private Integer routingId; private Integer routingId;
private String routingCode; private String routingCode;
private String routingName; private String routingName;
...@@ -113,7 +113,7 @@ public class Entry { ...@@ -113,7 +113,7 @@ public class Entry {
/** /**
* 所需物料 * 所需物料
*/ */
public List<OrderMaterialRequirement> MaterialRequirements ; // 所需物料 private List<OrderMaterialRequirement> materialRequirements ; // 所需物料
......
...@@ -224,7 +224,7 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -224,7 +224,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
int scheduledCount1=scheduledCount; int scheduledCount1=scheduledCount;
List<Entry> allOperations=chromosome.getAllOperations(); List<Entry> allOperations=chromosome.getAllOperations();
Entry entry=allOperations.stream() Entry entry=allOperations.stream()
.filter(t->t.GroupId==num&&t.getSequence()==scheduledCount1) .filter(t->t.getGroupId()==num&&t.getSequence()==scheduledCount1)
.findFirst().orElse(null); .findFirst().orElse(null);
if(entry!=null&&entry.getDependentOnOrderIds().size()>0) if(entry!=null&&entry.getDependentOnOrderIds().size()>0)
{ {
...@@ -255,7 +255,7 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -255,7 +255,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
} }
int scheduledCount1=scheduledCount; int scheduledCount1=scheduledCount;
Entry entry=allOperations.stream() Entry entry=allOperations.stream()
.filter(t->t.GroupId==orderid&&t.getSequence()==scheduledCount1) .filter(t->t.getGroupId()==orderid&&t.getSequence()==scheduledCount1)
.findFirst().orElse(null); .findFirst().orElse(null);
if(entry!=null&&entry.getDependentOnOrderIds().size()>0) { if(entry!=null&&entry.getDependentOnOrderIds().size()>0) {
...@@ -704,7 +704,7 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -704,7 +704,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
if (FsOperations != null && FsOperations.size() > 0) { if (FsOperations != null && FsOperations.size() > 0) {
for (OperationDependency opid : FsOperations) { for (OperationDependency opid : FsOperations) {
List<GAScheduleResult> prevOperations = chromosome.getResult().stream() List<GAScheduleResult> prevOperations = chromosome.getResult().stream()
.filter(t -> t.getGroupId() == currentOp.GroupId && t.getOperationId() == opid.getPrevOperationId()) .filter(t -> t.getGroupId() == currentOp.getGroupId() && t.getOperationId() == opid.getPrevOperationId())
.collect(Collectors.toList());//多台 .collect(Collectors.toList());//多台
for (GAScheduleResult prevOp : prevOperations) { for (GAScheduleResult prevOp : prevOperations) {
//加上后处理时间 //加上后处理时间
...@@ -722,7 +722,7 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -722,7 +722,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
for (OperationDependency opid : SSOperations) { for (OperationDependency opid : SSOperations) {
List<GAScheduleResult> prevOperations = chromosome.getResult().stream() List<GAScheduleResult> prevOperations = chromosome.getResult().stream()
.filter(t -> t.getGroupId() == currentOp.GroupId && t.getOperationId() == opid.getPrevOperationId()) .filter(t -> t.getGroupId() == currentOp.getGroupId() && t.getOperationId() == opid.getPrevOperationId())
.collect(Collectors.toList());//多台 .collect(Collectors.toList());//多台
for (GAScheduleResult prevOp : prevOperations) { for (GAScheduleResult prevOp : prevOperations) {
newScheduleResult.add(prevOp); newScheduleResult.add(prevOp);
......
...@@ -154,7 +154,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders)); ...@@ -154,7 +154,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders));
if(optionalMachines==null||optionalMachines.size()==0) if(optionalMachines==null||optionalMachines.size()==0)
{ {
throw new RuntimeException("工序没有设置设备"+op.OrderCode+":"+op.getSequence()); throw new RuntimeException("工序没有设置设备"+op.getOrderCode()+":"+op.getSequence());
} }
...@@ -237,7 +237,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders)); ...@@ -237,7 +237,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders));
if(optionalMachines==null||optionalMachines.size()==0) if(optionalMachines==null||optionalMachines.size()==0)
{ {
throw new RuntimeException("工序没有设置设备"+op.OrderCode+":"+op.getSequence()); throw new RuntimeException("工序没有设置设备"+op.getOrderCode()+":"+op.getSequence());
} }
...@@ -308,7 +308,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders)); ...@@ -308,7 +308,7 @@ chromo.setOrders(new CopyOnWriteArrayList<>(orders));
List<MachineOption> optionalMachines = op.getMachineOptions(); List<MachineOption> optionalMachines = op.getMachineOptions();
if(optionalMachines==null||optionalMachines.size()==0) if(optionalMachines==null||optionalMachines.size()==0)
{ {
throw new RuntimeException("工序没有设置设备"+op.OrderCode+":"+op.getSequence()); throw new RuntimeException("工序没有设置设备"+op.getOrderCode()+":"+op.getSequence());
} }
int randomSeq = rnd.nextInt(optionalMachines.size()) + 1; int randomSeq = rnd.nextInt(optionalMachines.size()) + 1;
......
...@@ -73,7 +73,7 @@ int newStartTime=0; ...@@ -73,7 +73,7 @@ int newStartTime=0;
.filter(o -> o.getId() == targetopId) .filter(o -> o.getId() == targetopId)
.findFirst() .findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + targetopId)); .orElseThrow(() -> new NoSuchElementException("Operation not found: " + targetopId));
int GroupId=targetOp1.GroupId; int GroupId=targetOp1.getGroupId();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(GroupId)) // 过滤出值为1的索引
.skip(targetOp1.Sequence-1) // 跳过第一个匹配项 .skip(targetOp1.Sequence-1) // 跳过第一个匹配项
...@@ -120,12 +120,12 @@ int newStartTime=0; ...@@ -120,12 +120,12 @@ int newStartTime=0;
if(targetopId!=0) { if(targetopId!=0) {
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(targetOp.GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(targetOp.getGroupId())) // 过滤出值为1的索引
.skip(targetOp.Sequence - 1) // 跳过第一个匹配项 .skip(targetOp.Sequence - 1) // 跳过第一个匹配项
.findFirst(); // 取第二个匹配项 .findFirst(); // 取第二个匹配项
int targetOpIndex = OperationIndex.getAsInt(); int targetOpIndex = OperationIndex.getAsInt();
opsIndexs.add(targetOpIndex); opsIndexs.add(targetOpIndex);
ordersIds.add(targetOp.GroupId); ordersIds.add(targetOp.getGroupId());
List<Entry> targetOp2s = allOperations.stream() List<Entry> targetOp2s = allOperations.stream()
.filter(o -> o.getGroupId() == targetOp.getGroupId() .filter(o -> o.getGroupId() == targetOp.getGroupId()
&& o.getSequence() > targetOp.getSequence()).collect(Collectors.toList()); && o.getSequence() > targetOp.getSequence()).collect(Collectors.toList());
...@@ -134,14 +134,14 @@ int newStartTime=0; ...@@ -134,14 +134,14 @@ int newStartTime=0;
{ {
for (Entry targetOp4:targetOp2s) { for (Entry targetOp4:targetOp2s) {
OptionalInt OperationIndex1 = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex1 = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(targetOp.GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(targetOp.getGroupId())) // 过滤出值为1的索引
.skip(targetOp4.Sequence - 1) // 跳过第一个匹配项 .skip(targetOp4.Sequence - 1) // 跳过第一个匹配项
.findFirst(); // 取第二个匹配项 .findFirst(); // 取第二个匹配项
int targetOpIndex2 = OperationIndex1.getAsInt(); int targetOpIndex2 = OperationIndex1.getAsInt();
if(targetOpIndex2<targetopIndex1)//后面的工序位置比目标位置靠前 if(targetOpIndex2<targetopIndex1)//后面的工序位置比目标位置靠前
{//后面的工序也要往后挪 {//后面的工序也要往后挪
opsIndexs.add(targetOpIndex2); opsIndexs.add(targetOpIndex2);
ordersIds.add(targetOp.GroupId); ordersIds.add(targetOp.getGroupId());
} }
} }
} }
...@@ -187,7 +187,7 @@ int newStartTime=0; ...@@ -187,7 +187,7 @@ int newStartTime=0;
} }
} }
int GroupId=targetOp1.GroupId; int GroupId=targetOp1.getGroupId();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(GroupId)) // 过滤出值为1的索引
.skip(targetOp1.Sequence-1) // 跳过第一个匹配项 .skip(targetOp1.Sequence-1) // 跳过第一个匹配项
...@@ -609,7 +609,7 @@ if(targetOp.getSequence()>1) { ...@@ -609,7 +609,7 @@ if(targetOp.getSequence()>1) {
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId)); .orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
// 找到原来的组和父子级 // 找到原来的组和父子级
GroupResult groupResult = OperatRels.get(targetOp.GroupId-1); GroupResult groupResult = OperatRels.get(targetOp.getGroupId()-1);
List<NodeInfo> nodeInfoList = groupResult.getNodeInfoList(); List<NodeInfo> nodeInfoList = groupResult.getNodeInfoList();
NodeInfo Oprel = nodeInfoList.stream() NodeInfo Oprel = nodeInfoList.stream()
...@@ -618,7 +618,7 @@ if(targetOp.getSequence()>1) { ...@@ -618,7 +618,7 @@ if(targetOp.getSequence()>1) {
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId)); .orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
int targetGroupIndex = targetOp.GroupId - 1; int targetGroupIndex = targetOp.getGroupId() - 1;
List<Integer> newParentIds = Oprel.getNewParentIds(); List<Integer> newParentIds = Oprel.getNewParentIds();
List<Integer> newChildIds = Oprel.getNewChildIds(); List<Integer> newChildIds = Oprel.getNewChildIds();
//记录新的工序ID和数量 //记录新的工序ID和数量
...@@ -655,7 +655,7 @@ if(targetOp.getSequence()>1) { ...@@ -655,7 +655,7 @@ if(targetOp.getSequence()>1) {
int machineSeq =index.orElse(0)+1 ; int machineSeq =index.orElse(0)+1 ;
List<Integer> OperationSequencing= chromosome.getOperationSequencing(); List<Integer> OperationSequencing= chromosome.getOperationSequencing();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(targetOp.GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(targetOp.getGroupId())) // 过滤出值为1的索引
.skip(targetOp.Sequence-1) // 跳过第一个匹配项 .skip(targetOp.Sequence-1) // 跳过第一个匹配项
.findFirst(); // 取第二个匹配项 .findFirst(); // 取第二个匹配项
int targetOpIndex= OperationIndex.getAsInt()+1; int targetOpIndex= OperationIndex.getAsInt()+1;
...@@ -912,7 +912,7 @@ if(targetOp.getSequence()>1) { ...@@ -912,7 +912,7 @@ if(targetOp.getSequence()>1) {
List<Integer> OperationSequencing= chromosome.getOperationSequencing(); List<Integer> OperationSequencing= chromosome.getOperationSequencing();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(entry.GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(entry.getGroupId())) // 过滤出值为1的索引
.skip(entry.Sequence-1) // 跳过第一个匹配项 .skip(entry.Sequence-1) // 跳过第一个匹配项
.findFirst(); .findFirst();
int targetOpIndex= OperationIndex.getAsInt()+1; int targetOpIndex= OperationIndex.getAsInt()+1;
...@@ -961,7 +961,7 @@ if(targetOp.getSequence()>1) { ...@@ -961,7 +961,7 @@ if(targetOp.getSequence()>1) {
.collect(Collectors.toList()); .collect(Collectors.toList());
int GroupId=0; int GroupId=0;
for (Entry entry : sourceOps) { for (Entry entry : sourceOps) {
GroupId= entry.GroupId; GroupId= entry.getGroupId();
OptionalInt index = IntStream.range(0, allOperations.size()) OptionalInt index = IntStream.range(0, allOperations.size())
.filter(h -> entry.getId()==allOperations.get(h).getId()) .filter(h -> entry.getId()==allOperations.get(h).getId())
.findFirst(); .findFirst();
...@@ -975,7 +975,7 @@ if(targetOp.getSequence()>1) { ...@@ -975,7 +975,7 @@ if(targetOp.getSequence()>1) {
chromosome.getMachineSelection().remove((int)index1.orElse(0)); chromosome.getMachineSelection().remove((int)index1.orElse(0));
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(entry.GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(entry.getGroupId())) // 过滤出值为1的索引
.findFirst(); .findFirst();
int targetOpIndex= OperationIndex.getAsInt(); int targetOpIndex= OperationIndex.getAsInt();
OperationSequencing.remove((int)targetOpIndex); OperationSequencing.remove((int)targetOpIndex);
...@@ -1033,10 +1033,10 @@ if(targetOp.getSequence()>1) { ...@@ -1033,10 +1033,10 @@ if(targetOp.getSequence()>1) {
List<Entry> entrys = allOperations.stream() List<Entry> entrys = allOperations.stream()
.filter(o -> o.GroupId == targetOp.GroupId) .filter(o -> o.getGroupId() == targetOp.getGroupId())
.collect(Collectors.toList()); .collect(Collectors.toList());
//当前组的 //当前组的
GroupResult groupResult = OperatRels.get(targetOp.GroupId-1); GroupResult groupResult = OperatRels.get(targetOp.getGroupId()-1);
List<NodeInfo> nodeInfoList = groupResult.getNodeInfoList(); List<NodeInfo> nodeInfoList = groupResult.getNodeInfoList();
List<GlobalOperationInfo> globalOpList = chromosome.getGlobalOpList(); List<GlobalOperationInfo> globalOpList = chromosome.getGlobalOpList();
...@@ -1108,8 +1108,8 @@ if(targetOp.getSequence()>1) { ...@@ -1108,8 +1108,8 @@ if(targetOp.getSequence()>1) {
List<Integer> OperationSequencing= chromosome.getOperationSequencing(); List<Integer> OperationSequencing= chromosome.getOperationSequencing();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(targetOp.GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(targetOp.getGroupId())) // 过滤出值为1的索引
.skip(targetOp.Sequence-1) // 跳过第一个匹配项 .skip(targetOp.getSequence()-1) // 跳过第一个匹配项
.findFirst(); .findFirst();
chromosome.getOperationSequencing().remove((int)OperationIndex.getAsInt()); chromosome.getOperationSequencing().remove((int)OperationIndex.getAsInt());
...@@ -1168,7 +1168,7 @@ if(targetOp.getSequence()>1) { ...@@ -1168,7 +1168,7 @@ if(targetOp.getSequence()>1) {
.collect(Collectors.toList()); .collect(Collectors.toList());
int GroupId=0; int GroupId=0;
for (Entry entry : sourceOps) { for (Entry entry : sourceOps) {
GroupId= entry.GroupId; GroupId= entry.getGroupId();
OptionalInt index = IntStream.range(0, allOperations.size()) OptionalInt index = IntStream.range(0, allOperations.size())
.filter(h -> entry.getId()==allOperations.get(h).getId()) .filter(h -> entry.getId()==allOperations.get(h).getId())
.findFirst(); .findFirst();
...@@ -1182,7 +1182,7 @@ if(targetOp.getSequence()>1) { ...@@ -1182,7 +1182,7 @@ if(targetOp.getSequence()>1) {
chromosome.getMachineSelection().remove((int)index1.orElse(0)); chromosome.getMachineSelection().remove((int)index1.orElse(0));
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size()) OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(entry.GroupId)) // 过滤出值为1的索引 .filter(i -> OperationSequencing.get(i).equals(entry.getGroupId())) // 过滤出值为1的索引
.findFirst(); .findFirst();
int targetOpIndex= OperationIndex.getAsInt(); int targetOpIndex= OperationIndex.getAsInt();
OperationSequencing.remove((int)targetOpIndex); OperationSequencing.remove((int)targetOpIndex);
......
...@@ -39,7 +39,7 @@ public class PlanResultServiceTest { ...@@ -39,7 +39,7 @@ public class PlanResultServiceTest {
// TestSortService sortService=new TestSortService(); // TestSortService sortService=new TestSortService();
// sortService.test1(); // sortService.test1();
// nsgaiiUtils.Test(); // nsgaiiUtils.Test();
planResultService.execute2("921BC266191E4812A105E406BF91E812"); // planResultService.execute2("921BC266191E4812A105E406BF91E812");
// planResultService.execute2("00E0C5D3E4AD4F36B56C39395906618D"); // planResultService.execute2("00E0C5D3E4AD4F36B56C39395906618D");
// planResultService.execute2("726D4C1A712B4B1393175BD44B775B66"); // planResultService.execute2("726D4C1A712B4B1393175BD44B775B66");
...@@ -51,10 +51,10 @@ public class PlanResultServiceTest { ...@@ -51,10 +51,10 @@ public class PlanResultServiceTest {
// planResultService.Redecode("27065EA0ECD14A81B7FAAFEF52273F93"); // planResultService.Redecode("27065EA0ECD14A81B7FAAFEF52273F93");
// planResultService.Redecode("921BC266191E4812A105E406BF91E812"); // planResultService.Redecode("921BC266191E4812A105E406BF91E812");
// planResultService.Drag("27065EA0ECD14A81B7FAAFEF52273F93",opids,6,false,0l); // planResultService.Drag("27065EA0ECD14A81B7FAAFEF52273F93",opids,6,false,0l);
// MaintenanceWindow maintenanceWindow=new MaintenanceWindow(); MaintenanceWindow maintenanceWindow=new MaintenanceWindow();
// maintenanceWindow.setStartTime(LocalDateTime.of(2026, 2, 4, 0, 0, 0)); maintenanceWindow.setStartTime(LocalDateTime.of(2026, 9, 13, 0, 0, 0));
// maintenanceWindow.setEndTime(LocalDateTime.of(2025, 2, 5, 0, 0, 0)); maintenanceWindow.setEndTime(LocalDateTime.of(2025, 9, 19, 0, 0, 0));
// planResultService.AddMaintenanceWindow("00E0C5D3E4AD4F36B56C39395906618D",2492l,maintenanceWindow); planResultService.AddMaintenanceWindow("5475E00B844847ACB6DC20227967BA2F",2488l,maintenanceWindow);
// // planResultService.DelOperation("B6AE363FF5044DDF8DECE32D5FE0F7EA",7); // // planResultService.DelOperation("B6AE363FF5044DDF8DECE32D5FE0F7EA",7);
// planResultService.SpiltOrder("A41D662EE0764D008173C5A0E42B15F6","5f9d5383-b89a-4a4f-8805-2f617c711968",new Double[]{500d, 500d}); // planResultService.SpiltOrder("A41D662EE0764D008173C5A0E42B15F6","5f9d5383-b89a-4a4f-8805-2f617c711968",new Double[]{500d, 500d});
......
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