Commit 37065872 authored by Tong Li's avatar Tong Li

拖到,固定开始日期,锁定

parent 236185e3
......@@ -197,7 +197,7 @@ public class ResourceGanttController {
opids.add(opid);
// 3. 执行业务
Chromosome result = planResultService.Move(sceneId, opids, newStartTime, newMachineId);
Chromosome result = planResultService.Move(sceneId, opids, newStartTime, newMachineId,0);
return R.ok("移动成功");
}
......@@ -219,7 +219,7 @@ public class ResourceGanttController {
// 3. 执行业务
Chromosome result = planResultService.Move(sceneId, opids, newStartTime, newMachineId);
Chromosome result = planResultService.Move(sceneId, opids, newStartTime, newMachineId,0);
return R.ok("移动成功");
}
......@@ -245,7 +245,7 @@ public class ResourceGanttController {
opids.add(opid);
// 3. 执行业务
Chromosome result = planResultService.Move(sceneId, opids, newStartTime, 0L);
Chromosome result = planResultService.Move(sceneId, opids, newStartTime, 0L,1);
return R.ok("固定开始日期成功");
}
......
......@@ -29,7 +29,8 @@ public class GAScheduleResult {
private int teardownTime; //后处理
private double Quantity; // 批次大小(订单可拆分)
private List<ScheduleResultDetail> GeneDetails; // 时间详情
private int designatedStartTime = -1; // 设计开始时间(默认-1)
private int designatedStartTime = -1; // 固定开始时间(默认-1)
private int lockStartTime = 0; // 是否固定开始时间(默认-1)
private Long forcedMachineId =-1L; // 强制分配的设备ID(-1表示无强制)
private boolean IsLocked=false;
private double OneTime; // 单件工时
......
......@@ -513,7 +513,12 @@ if(finishedOrder==null||finishedOrder.size()==0)
result.setChangeOverTime(setupTime);
result.setPreTime(preTime);
result.setTeardownTime(teardownTime);
if(existingResult!=null) {
if(existingResult.getLockStartTime()==1) {
result.setLockStartTime(existingResult.getLockStartTime());
result.setDesignatedStartTime(existingResult.getDesignatedStartTime());
}
}
result.setProcessingTime(processingTimeTotal);
......
......@@ -33,7 +33,7 @@ public class ScheduleOperationService {
* @param newMachineId 新设备ID
*/
public void moveOperation(Chromosome chromosome, List<Integer> opIds, int newStartTime,
Long newMachineId, GlobalParam globalParam) {
Long newMachineId, GlobalParam globalParam,int lockStartTime) {
List<Entry> allOperations = chromosome.getAllOperations();
int newStartTime1=newStartTime;
Map<Integer, Integer> opTimeMap = chromosome.getResult().stream()
......@@ -82,6 +82,7 @@ Integer newMachineId1=newMachineId.intValue();
}
// 设置约束
targetResult.setDesignatedStartTime(newStartTime);
targetResult.setLockStartTime(lockStartTime);
if(targetOp.getSequence()==1) {
......@@ -709,12 +710,16 @@ Integer newMachineId1=newMachineId.intValue();
}
public void LockOperation(Chromosome chromosome,int opId, boolean isLocked, GlobalParam globalParam)
{
GAScheduleResult targetResult = chromosome.getResult().stream()
.filter(r -> r.getOperationId() == opId)
Entry targetOp = chromosome.getAllOperations().stream()
.filter(o -> o.getId() == opId)
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
targetResult.setIsLocked(isLocked);
List<GAScheduleResult> targetResults = chromosome.getResult().stream()
.filter(r ->r.getGroupId()== targetOp.getGroupId()&&r.getOperationId() <= opId).collect(Collectors.toList());
targetResults.forEach(t->t.setIsLocked(isLocked));
// 若解锁,重新解码受影响工序
if (!isLocked)
......
......@@ -430,7 +430,7 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
return chromosome;
}
public Chromosome Move(String SceneId,List<Integer> opId, LocalDateTime newStartTime,
Long newMachineId) {
Long newMachineId,int lockStartTime) {
GlobalParam globalParam=new GlobalParam();
......@@ -440,8 +440,8 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
// WriteScheduleSummary(chromosome);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
WriteScheduleSummary(chromosome);
ScheduleOperation.moveOperation(chromosome,opId, (int)ChronoUnit.SECONDS.between(chromosome.getBaseTime(), newStartTime),newMachineId, globalParam);
WriteScheduleSummary(chromosome);
ScheduleOperation.moveOperation(chromosome,opId, (int)ChronoUnit.SECONDS.between(chromosome.getBaseTime(), newStartTime),newMachineId, globalParam, lockStartTime);
// WriteScheduleSummary(chromosome);
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
......
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