Commit 638640d4 authored by Tong Li's avatar Tong Li

遗传算法-bom

parent f4f283b7
package com.aps.entity.Algorithm;
import com.aps.entity.basic.Entry;
import com.aps.entity.basic.Machine;
import com.aps.entity.basic.Order;
import java.util.List;
......@@ -12,9 +14,15 @@ public class BOMBuildResult {
private List<OrderMaterialRequirement> materialRequirements;
private List<Order> childOrders;
public BOMBuildResult(List<OrderMaterialRequirement> materialRequirements, List<Order> childOrders) {
private List<Entry> newentrys;
private List<Machine> newMachines;
public BOMBuildResult(List<OrderMaterialRequirement> materialRequirements, List<Order> childOrders,List<Entry> newentrys,List<Machine> newMachines) {
this.materialRequirements = materialRequirements;
this.childOrders = childOrders;
this.newentrys=newentrys;
this.newMachines=newMachines;
}
public List<OrderMaterialRequirement> getMaterialRequirements() {
......@@ -24,4 +32,12 @@ public class BOMBuildResult {
public List<Order> getChildOrders() {
return childOrders;
}
public List<Entry> getNewEntrys() {
return newentrys;
}
public List<Machine> getNewMachines() {
return newMachines;
}
}
......@@ -59,6 +59,9 @@ public class Chromosome {
private List<Entry> allOperations;
private List<Order> orders;
private List<Machine> InitMachines;
private List<OrderMaterialRequirement> orderMaterials;
private List<GroupResult> OperatRel;
private double[] Objectives ; // 多目标值:[Makespan, TotalFlowTime, TotalChangeover, LoadStd, Delay]
......
......@@ -5,6 +5,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -17,7 +18,12 @@ public class OrderMaterialRequirement {
private int operationId;
private String childorderId;
private String materialId;
private MaterialType materialType;
private String materialTypeName;
/**
* 物料类型
*/
private Long materialType;
/**
* 需求总数
......@@ -72,5 +78,10 @@ public class OrderMaterialRequirement {
/**
* 创建或使用的半成品订单ID
*/
private List<String> productOrderID;
private List<Integer> productOrderID=new ArrayList<>();
/**
* 检验周期
*/
private Long CkeckLeadTime;
}
......@@ -88,7 +88,7 @@ public class MaterialInfo implements Serializable {
private Long inspectDuration;
@TableField("purchase_duration")
private Long purchaseDuration;
private int purchaseDuration;
@TableField("first_lot")
private String firstLot;
......
......@@ -22,7 +22,7 @@ private String materialVersion;
private Long storeId;
private String storeCode;
private String storeName;
private BigDecimal total;
private double total;
private Integer measureUnit;
private BigDecimal totalLock;
private BigDecimal cost;
......
......@@ -13,5 +13,5 @@ public class StrategyScheduling {
private String content;
private int amplitude;
private boolean value;
private int sort;
}
\ No newline at end of file
......@@ -27,10 +27,12 @@ public class Entry {
*/
public int GroupId ;
public String OrderId ;
/**
* 原订单ID
*/
public String OrderId ;
public String SceneId ;
private Integer routingId;
private Long routingDetailId;
private Long taskSeq;
......@@ -107,7 +109,7 @@ public class Entry {
/// <summary>
/// 当前工序依赖的前置工序ID(半成品工序→成品工序)
/// </summary>
public List<String> DependentOnOrderIds = new ArrayList<>();
public List<Integer> DependentOnOrderIds =new ArrayList<>();
......
......@@ -16,6 +16,11 @@ public class Material {
*/
private String Id;
/**
* 物料名称
*/
private String code;
/**
* 物料名称
*/
......@@ -41,7 +46,15 @@ public class Material {
/**
* 物料类型
*/
private MaterialType MaterialType;
private Long MaterialType;
private String materialTypeName;
/**
* 检验周期
*/
private Long CkeckLeadTime;
@Override
public String toString() {
return "Material{" +
......
......@@ -40,7 +40,7 @@ public class Order {
private double actualPriority;
private String mainId;
/*使用这个半成品的成品工单*/
public List<String> FinishOrderId ;
public List<Integer> FinishOrderId ;
private double delayHours;//延迟时间
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.aps.entity.Algorithm.*;
import com.aps.entity.Algorithm.IDAndChildID.GroupResult;
import com.aps.entity.basic.*;
import com.aps.service.plan.MachineSchedulerService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.util.stream.Collectors;
......@@ -14,6 +15,7 @@ import java.util.stream.Collectors;
* 作者:佟礼
* 时间:2025-11-21
*/
public class GeneticAlgorithm {
private final Random rnd = new Random();
private final List<Machine> machines;
......@@ -29,14 +31,21 @@ public class GeneticAlgorithm {
private ObjectiveWeights _objectiveWeights = new ObjectiveWeights();
private MaterialRequirementService materialRequirementService;
private List<OrderMaterialRequirement> orderMaterials;
public GeneticAlgorithm(GlobalParam globalParam,List<Machine> machines, List<Order> orders,
List<Material> materials, MachineSchedulerService machineScheduler,List<GroupResult> entryRel) {
List<Material> materials, MachineSchedulerService machineScheduler,List<GroupResult> entryRel,MaterialRequirementService _materialRequirementService) {
this.machines = machines;
this.orders = orders;
this.materials = materials;
this.machineScheduler = machineScheduler;
_GlobalParam=globalParam;
_entryRel=entryRel;
materialRequirementService=_materialRequirementService;
}
public void Init(double[] customWeights, boolean pureNSGAIIMode) {
......@@ -50,12 +59,14 @@ public class GeneticAlgorithm {
}
public Chromosome Run(ScheduleParams param, List<Entry> allOperations) {
if(_GlobalParam.isIsCheckBom()) {
materialRequirementService.init(materials, orders, allOperations, _entryRel, machineScheduler, machines);
orderMaterials = materialRequirementService.buildMultiLevelRequirementNetwork(param.getBaseTime());
}
System.out.println("开始");
Initialization initialization = new Initialization(_GlobalParam,allOperations);
Initialization initialization = new Initialization(_GlobalParam,allOperations,orders);
GeneticOperations geneticOps = new GeneticOperations(_GlobalParam,allOperations,param);
......@@ -174,6 +185,7 @@ public class GeneticAlgorithm {
best.setBaseTime(param.getBaseTime());
best.setInitMachines(ProductionDeepCopyUtil.deepCopyList(machines));
best.setOrders(orders);
best.setOrderMaterials(orderMaterials);
best.setOperatRel(_entryRel);
// 步骤3:返回最优解
return best;
......@@ -181,20 +193,10 @@ public class GeneticAlgorithm {
}
private void Chromosomedecode(ScheduleParams param, List<Entry> allOperations,List<GlobalOperationInfo> globalOpList,List<Chromosome> population)
{
GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler);
GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,orderMaterials);
// population.parallelStream().forEach(chromosome -> {
// chromosome.setResult(new ArrayList<>());
//
// // 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
// chromosome.setMachines(ProductionDeepCopyUtil.deepCopyList(machines)); // 简单拷贝,实际可能需要深拷贝
//
// decoder.decodeChromosomeWithCache(chromosome, globalOpList, allOperations);
// chromosome.setFitness(fitnessCalc.calculateFitness(chromosome));
// });
if(population!=null&&population.size()>0) {
population.forEach(chromosome -> {
population.parallelStream().forEach(chromosome -> {
chromosome.setResult(new ArrayList<>());
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
......
......@@ -6,6 +6,7 @@ import com.aps.entity.Algorithm.ScheduleParams;
import com.aps.entity.basic.Entry;
import com.aps.entity.basic.GlobalParam;
import com.aps.entity.basic.MachineOption;
import com.aps.entity.basic.Order;
import java.util.*;
import java.util.stream.Collectors;
......@@ -19,9 +20,12 @@ public class Initialization {
private static List<Entry> allOperations;
private static GlobalParam _globalParam;
public Initialization(GlobalParam globalParam,List<Entry> allOperations) {
private static List<Order> orders;
public Initialization(GlobalParam globalParam,List<Entry> allOperations,List<Order> _orders) {
Initialization.allOperations = allOperations;
_globalParam= globalParam;
orders=_orders;
}
/**
* 预生成全局工序列表(按“订单0→订单1→…+订单内工序1→2→…”排序,分配GlobalOpId)
......@@ -44,32 +48,36 @@ public class Initialization {
* 生成初始种群
*/
public List<Chromosome> generateInitialPopulation(ScheduleParams param, List<GlobalOperationInfo> globalOpList) {
List<Chromosome> population = new ArrayList<>();
// 按比例生成不同类型个体(GS:40%, LS:40%, RS:20%)
int gsCount = (int) (param.getPopulationSize() * param.getGsRatio());
int lsCount = gsCount + (int) (param.getPopulationSize() * param.getLsRatio());
int lsCount =gsCount+ (int) (param.getPopulationSize() * param.getLsRatio());
int rsCount = param.getPopulationSize() - gsCount - lsCount;
int populationSize = param.getPopulationSize();
// 使用并行流生成所有染色体,然后收集到列表中,避免并发修改ArrayList的问题
List<Chromosome> population = IntStream.range(0, populationSize)
.parallel()
.mapToObj(i -> {
Chromosome chromo = new Chromosome();
int populationSize=param.getPopulationSize();
// 并行循环:对应 Parallel.For(0, PopulationSize, i => { ... })
IntStream.range(0, populationSize)
.parallel() // 开启并行
.forEach(i -> {
Chromosome chromo = new Chromosome(); // 初始化染色体
chromo.setOrders(orders);
// 全局选择(GS):按GlobalOpId顺序生成MachineSelection
if (i < gsCount) {
generateGSChromosome(chromo, globalOpList);
generateGSChromosome(chromo,globalOpList); // 对应 C# GenerateGSChromosome
} else if (i < lsCount) {
// 局部选择(LS):按GlobalOpId顺序生成MachineSelection(仅负载计算范围不同)
generateLSChromosome(chromo, globalOpList);
generateLSChromosome(chromo,globalOpList);
} else {
// 随机选择(RS):按GlobalOpId顺序生成MachineSelection(仅机器选择随机)
generateRSChromosome(chromo, globalOpList);
// 随机选择(RS):按GlobalOpId顺序生成MachineSelection(仅机器选择随机)
generateRSChromosome(chromo,globalOpList);
}
return chromo;
})
.collect(Collectors.toList());
population.add(chromo); // 赋值到数组,线程安全(数组索引唯一)
});
return population;
}
......@@ -109,6 +117,7 @@ public class Initialization {
.min(Comparator.comparingDouble(m ->machineLoad.getOrDefault(m.getMachineId(), (double)0) + m.getProcessingTime()))
.orElseThrow(() -> new NoSuchElementException("MachineOption not found for machine: " ));
OptionalInt index = IntStream.range(0, optionalMachines.size())
.filter(i -> minLoadMachine.getMachineId()==optionalMachines.get(i).getMachineId())
.findFirst();
......@@ -172,10 +181,6 @@ public class Initialization {
// 选择“当前订单内设备负载+加工时间”最小的机器
List<MachineOption> optionalMachines = op.getMachineOptions();
if (optionalMachines == null || optionalMachines.isEmpty()) {
throw new IllegalStateException("工序 " + op.getId() + " 没有可用的机器选项");
}
MachineOption minLoadMachine = optionalMachines.stream()
......
......@@ -5,14 +5,15 @@ import com.aps.entity.Algorithm.DependencyType;
import com.aps.entity.Algorithm.IDAndChildID.GroupResult;
import com.aps.entity.Algorithm.IDAndChildID.NodeInfo;
import com.aps.entity.Algorithm.OperationDependency;
import com.aps.entity.basic.Entry;
import com.aps.entity.basic.MachineOption;
import com.aps.entity.basic.Order;
import com.aps.entity.basic.*;
import com.aps.service.*;
import com.aps.service.plan.MachineSchedulerService;
import com.aps.service.plan.SceneService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
......@@ -46,6 +47,12 @@ public class RoutingDataService {
@Autowired
private DiscreteParameterMatrixService _discreteParameterMatrixService;
@Autowired
private ProdEquipSpecialCalService _prodEquipSpecialCalService;
@Autowired
private MesShiftWorkSchedService _MesShiftWorkSchedService;
public Map<Integer, Object> InitEntrys(String SceneId, List<ProdEquipment> ProdEquipments, List<Order> ProdLaunchOrders)
{
Map<Integer, Object> list=new HashMap<>();
......@@ -125,7 +132,7 @@ public class RoutingDataService {
// nodeInfo.getNewChildIds());
Entry entry = new Entry();
entry.setSceneId(SceneId);
entry.setId(nodeInfo.getGlobalSerial());
entry.setGroupId(i + 1);
entry.setSequence(nodeInfo.getGroupSerial());
......@@ -191,6 +198,7 @@ public class RoutingDataService {
if (order != null) {
entry.setProductId(order.getMaterialId());
entry.setPriority(order.getActualPriority());
order.setId(entry.getGroupId());
}
List<ProdEquipment> Equipments = ProdEquipments.stream()
.filter(t -> t.getExecId().equals(op.getExecId()))
......@@ -224,4 +232,154 @@ public class RoutingDataService {
return list;
}
public List<Machine> InitCalendarToAllMachines(String SceneId, List<ProdEquipment> ProdEquipments, MachineSchedulerService machineScheduler) {
// 按设备分组
List<Long> MachineIds = ProdEquipments.stream()
.map(ProdEquipment::getEquipId)
.distinct()
.sorted()
.collect(Collectors.toList());
List<Machine> machines=new ArrayList<>();
for (Long id : MachineIds) {
Machine machine=new Machine();
machine.setId(id);
machines.add(machine);
}
//节假日
// List<MesHoliday> holidays= _MesHolidayService.list();
LambdaQueryWrapper<ProdEquipSpecialCal> ProdEquipSpecialCalWrapper = new LambdaQueryWrapper<>();
ProdEquipSpecialCalWrapper.eq(ProdEquipSpecialCal::getSceneId, SceneId);
List<PlanResource> PlanResources= _PlanResourceService.lambdaQuery()
.eq(PlanResource::getIsdeleted,0)
.list();
List<ProdEquipSpecialCal> ProdEquipSpecialCals= _prodEquipSpecialCalService.list(ProdEquipSpecialCalWrapper);
List<MesShiftWorkSched> MesShiftWorkScheds= _MesShiftWorkSchedService.lambdaQuery()
.eq(MesShiftWorkSched::getIsdeleted,0).list();
if (machines == null) {
return null;
}
for (Machine machine : machines) {
// 确保维护窗口列表不为null
if (machine.getMaintenanceWindows() == null) {
machine.setMaintenanceWindows(new ArrayList<>());
}
List<ProdEquipSpecialCal> machineProdEquipSpecialCals = ProdEquipSpecialCals.stream()
.filter(t -> t.getEquipId() == machine.getId()&&t.getReferenceType()==1)
.collect(Collectors.toList());
List<Shift> shifts1=new ArrayList<>();
for (ProdEquipSpecialCal machineProdEquipSpecialCal : machineProdEquipSpecialCals) {
List<MesShiftWorkSched> ShiftWorkScheds = MesShiftWorkScheds.stream()
.filter(t -> (long) t.getWeekWorkSchedId() == machineProdEquipSpecialCal.getReferenceId())
.collect(Collectors.toList());
List<Shift> Shifts = mergeShiftData(ShiftWorkScheds);
for (Shift shift : Shifts) {
shift.setMachineId(machine.getId());
shift.setStartDate(machineProdEquipSpecialCal.getStartDate());
shift.setEndDate(machineProdEquipSpecialCal.getEndDate());
shifts1.add(shift);
}
}
List<PlanResource> PlanResources1 = PlanResources.stream()
.filter(t -> t.getReferenceId() == machine.getId())
.collect(Collectors.toList());
if(PlanResources1!=null&&PlanResources1.size()>0)
{
for (PlanResource PlanResource : PlanResources1) {
List<MesShiftWorkSched> ShiftWorkScheds = MesShiftWorkScheds.stream()
.filter(t -> (long) t.getWeekWorkSchedId() == PlanResource.getWorkSchedId())
.collect(Collectors.toList());
List<Shift> Shifts = mergeShiftData(ShiftWorkScheds);
for (Shift shift : Shifts) {
shift.setMachineId(machine.getId());
shift.setStartDate(LocalDateTime.of(2000, 1, 1, 0, 0, 0));
shift.setEndDate(LocalDateTime.of(2000, 1, 1, 0, 0, 0));
shifts1.add(shift);
}
}
}
machine.setShifts(shifts1);
List<ProdEquipSpecialCal> Holidays = ProdEquipSpecialCals.stream()
.filter(t -> t.getEquipId() == machine.getId()&&t.getReferenceType()==2)
.collect(Collectors.toList());
List<Holiday> Holidays1=new ArrayList<>();
for (ProdEquipSpecialCal machineProdEquipSpecialCal : Holidays) {
Holiday holiday=new Holiday();
holiday.setStart(machineProdEquipSpecialCal.getStartDate());
holiday.setEnd(machineProdEquipSpecialCal.getEndDate());
Holidays1.add(holiday);
}
machine.setHolidays(Holidays1);
}
// 4. 初始化机器时间线
for (Machine machine : machines) {
MachineTimeline timeline = machineScheduler.getOrCreateTimeline(machine);
machine.setAvailability(timeline.getSegments());
}
return machines;
}
/**
* 合并重复的ShiftData,将serialNumber收集为列表
* @param originalList 原始数据列表
* @return 合并后的MergedShiftData列表
*/
public static List<Shift> mergeShiftData(List<MesShiftWorkSched> originalList) {
// 按shiftStart和shiftEnd分组
Map<String, Shift> groupMap = new HashMap<>();
for (MesShiftWorkSched data : originalList) {
// 用shiftStart+shiftEnd作为分组key
String groupKey = data.getShiftStart().toString() + "_" + data.getShiftEnd().toString();
if (groupMap.containsKey(groupKey)) {
// 已存在分组:添加serialNumber到列表
Shift merged = groupMap.get(groupKey);
merged.getDays().add(data.getStartWeekDay());
} else {
// 新分组:创建MergedShiftData并初始化
Shift merged = new Shift();
merged.setStartTime(data.getShiftStart().toLocalTime());
merged.setEndTime(data.getShiftEnd().toLocalTime());
merged.setStatus(0);
// 初始化序号列表
Set<Integer> serials =new HashSet<>();
serials.add(data.getStartWeekDay());
merged.setDays(serials);
groupMap.put(groupKey, merged);
}
}
// 转换为列表返回
return new ArrayList<>(groupMap.values());
}
}
......@@ -53,7 +53,7 @@ public class ScheduleOperationService {
.indexOf(newMachineId) + 1;
if (machineOptionIndex == 0) {
throw new NoSuchElementException("不能移动到该设备");
throw new NoSuchElementException("Machine not found: " + newMachineId);
}
// 设置约束
......@@ -140,13 +140,13 @@ public class ScheduleOperationService {
// 添加新节点
OperatRels = IdGroupingWithDualSerial.addNode(OperatRels, targetGroupIndex, newId, newParentIds, newChildIds,targetOp.getExecId());
}
}
}
chromosome.setOperatRel(OperatRels);
//当前组的
groupResult = OperatRels.get(targetGroupIndex);
groupResult = OperatRels.get(targetGroupIndex);
nodeInfoList = groupResult.getNodeInfoList();
//全局ID
nodeInfoList = groupResult.getNodeInfoList();
//全局ID
int globalOpId = chromosome.getGlobalOpList().stream()
.mapToInt(GlobalOperationInfo::getGlobalOpId)
.max()
......@@ -163,7 +163,7 @@ public class ScheduleOperationService {
.filter(i -> OperationSequencing.get(i).equals(targetOp.GroupId)) // 过滤出值为1的索引
.skip(targetOp.Sequence-1) // 跳过第一个匹配项
.findFirst(); // 取第二个匹配项
int targetOpIndex= OperationIndex.getAsInt()+1;
int targetOpIndex= OperationIndex.getAsInt()+1;
for (NodeInfo nodeInfo : nodeInfoList) {
Entry entry = allOperations.stream()
.filter(o -> o.getId() == nodeInfo.getGlobalSerial())
......@@ -173,8 +173,8 @@ public class ScheduleOperationService {
{
//存在则修改顺和前后序
entry.setSequence(nodeInfo.getGroupSerial());
// entry.setPrevEntryIds(nodeInfo.getNewParentIds());
// entry.setNextEntryIds(nodeInfo.getNewChildIds());
// entry.setPrevEntryIds(nodeInfo.getNewParentIds());
// entry.setNextEntryIds(nodeInfo.getNewChildIds());
if(nodeInfo.getNewParentIds()!=null)
{
List<OperationDependency> OperationDependency=new ArrayList<>();
......@@ -183,9 +183,7 @@ public class ScheduleOperationService {
od.setPrevOperationId(id);
OperationDependency.add(od);
}
if (entry != null) {
entry.setPrevEntryIds(OperationDependency);
}
entry.setPrevEntryIds(OperationDependency);
}
if(nodeInfo.getNewChildIds()!=null)
{
......@@ -195,9 +193,7 @@ public class ScheduleOperationService {
od.setNextOperationId(id);
OperationDependency.add(od);
}
if (entry != null) {
entry.setNextEntryIds(OperationDependency);
}
entry.setNextEntryIds(OperationDependency);
}
GlobalOperationInfo info= chromosome.getGlobalOpList().stream()
.filter(t->t.getOp().getId()==entry.getId())
......@@ -219,8 +215,8 @@ public class ScheduleOperationService {
newOp.setId(nodeInfo.getGlobalSerial());
newOp.setSequence(nodeInfo.getGroupSerial());
newOp.setExecId(nodeInfo.getOriginalId());
// newOp.setPrevEntryIds(nodeInfo.getNewParentIds());
// newOp.setNextEntryIds(nodeInfo.getNewChildIds());
// newOp.setPrevEntryIds(nodeInfo.getNewParentIds());
// newOp.setNextEntryIds(nodeInfo.getNewChildIds());
if(nodeInfo.getNewParentIds()!=null)
{
List<OperationDependency> OperationDependency=new ArrayList<>();
......@@ -229,7 +225,7 @@ public class ScheduleOperationService {
od.setPrevOperationId(id);
OperationDependency.add(od);
}
newOp.setPrevEntryIds(OperationDependency);
entry.setPrevEntryIds(OperationDependency);
}
if(nodeInfo.getNewChildIds()!=null)
{
......@@ -239,7 +235,7 @@ public class ScheduleOperationService {
od.setNextOperationId(id);
OperationDependency.add(od);
}
newOp.setNextEntryIds(OperationDependency);
entry.setNextEntryIds(OperationDependency);
}
newOp.setQuantity(newids.get(nodeInfo.getOriginalId()));
newOp.setMainId(MainId);
......@@ -286,17 +282,6 @@ public class ScheduleOperationService {
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Order not found: " + orderId));
double sum = Arrays.stream(splitCounts)
.filter(Objects::nonNull)
.mapToDouble(Double::doubleValue)
.sum();
if(sum!=order.getQuantity()){
throw new RuntimeException("订单数量拆分不正确");
}
int maxorderId =OperatRels.size() ;
int maxgroupId =maxorderId ;
......@@ -571,9 +556,7 @@ public class ScheduleOperationService {
od.setPrevOperationId(id);
OperationDependency.add(od);
}
if (entry != null) {
entry.setPrevEntryIds(OperationDependency);
}
entry.setPrevEntryIds(OperationDependency);
}
if(node.getNewChildIds()!=null)
{
......@@ -583,9 +566,7 @@ public class ScheduleOperationService {
od.setNextOperationId(id);
OperationDependency.add(od);
}
if (entry != null) {
entry.setNextEntryIds(OperationDependency);
}
entry.setNextEntryIds(OperationDependency);
}
GlobalOperationInfo info= chromosome.getGlobalOpList().stream()
.filter(t->t.getOp().getId()==entry.getId())
......@@ -657,7 +638,7 @@ public class ScheduleOperationService {
{
MachineSchedulerService machineScheduler = new MachineSchedulerService(baseTime);
GeneticDecoder decoder = new GeneticDecoder(globalParam,baseTime, chromosome.getInitMachines(),
chromosome.getOrders(), null, machineScheduler);
chromosome.getOrders(), null, machineScheduler,chromosome.getOrderMaterials());
chromosome.setMachines(chromosome.getInitMachines());
chromosome.setResultOld(ProductionDeepCopyUtil.deepCopyList(chromosome.getResult()));
......
package com.aps.service;
import com.aps.common.util.R;
import com.aps.entity.*;
import java.util.List;
import java.util.Map;
/**
* 设备日历服务接口
......@@ -32,4 +34,23 @@ public interface LanuchService {
R<String> exportPlan( String sceneId);
List<RoutingDetail> getRoutingDetails(Integer routingHeaderId);
List<RoutingDetailEquip> getRoutingDetailEquip(Integer routingHeaderId, String routingCode);
ProdProcessExec createProcessExec(ProdLaunchOrder prodOrderMain,
RoutingDetail detail,
String sceneId);
List<ProdEquipment> batchInsertEquipMent(
List<RoutingDetailEquip> routingDetailEquips,
String sceneId,List<ProdProcessExec> processExecList,Boolean isSave);
List<ProdOrderProcess> createProcessRelations(ProdLaunchOrder prodOrderMain, String sceneId, Map<Long, String> routingDetailIdToExecIdMap);
ProdOrderProcess createProcessRelation(ProdLaunchOrder prodOrderMain,
RoutingDetailConnect connection,
String sceneId,
Map<Long, String> routingDetailIdToExecIdMap);
}
\ No newline at end of file
......@@ -758,7 +758,7 @@ public class LanuchServiceImpl implements LanuchService {
◦ @return 工序关系列表
*/
private List<ProdOrderProcess> createProcessRelations(ProdLaunchOrder prodOrderMain, String sceneId, Map<Long, String> routingDetailIdToExecIdMap) {
public List<ProdOrderProcess> createProcessRelations(ProdLaunchOrder prodOrderMain, String sceneId, Map<Long, String> routingDetailIdToExecIdMap) {
LambdaQueryWrapper<RoutingDetailConnect> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(RoutingDetailConnect::getRoutingHeaderId, prodOrderMain.getRoutingId())
.eq(RoutingDetailConnect::getIsdeleted, 0)
......
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