Commit ef3a51e0 authored by Tong Li's avatar Tong Li

Merge remote-tracking branch 'origin/master' into tl

parents 7351ba4a 87592467
......@@ -32,3 +32,14 @@ build/
### VS Code ###
.vscode/
/src/main/resources/application.yml
### Example user template template
### Example user template
# IntelliJ project files
.idea
*.iml
out
gen
!/logs/
!/log/
!/result/
This source diff could not be displayed because it is too large. You can view the blob instead.
2026-04-21 19:15:40.112 | main | com.aps.common.util.redis.RedisUtils | Redis 操作失败 1/3: get(material), 错误: Redis exception; nested exception is io.lettuce.core.RedisException: Connection closed
2026-04-21 19:15:40.627 | main | com.aps.common.util.redis.RedisUtils | Redis 操作失败 2/3: get(material), 错误: LettuceConnectionFactory was destroyed and cannot be used anymore
2026-04-21 19:58:28.398 | main | com.aps.common.util.redis.RedisUtils | Redis 操作失败 1/3: get(SceneId.6D63146BE5C84A78B5AB044327BA55BD), 错误: Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
2026-04-21 21:22:58.624 | main | com.aps.common.util.redis.RedisUtils | Redis 操作失败 1/3: get(SceneId.6D63146BE5C84A78B5AB044327BA55BD), 错误: Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
2026-04-24 11:05:58.256 | main | com.aps.common.util.redis.RedisUtils | Redis 操作失败 1/3: get(SceneId.6D63146BE5C84A78B5AB044327BA55BD), 错误: Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
2026-04-24 15:25:23.471 | main | com.aps.common.util.redis.RedisUtils | Redis 操作失败 1/3: get(SceneId.6D63146BE5C84A78B5AB044327BA55BD), 错误: Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
2026-04-24 15:57:33.089 | main | com.aps.common.util.redis.RedisUtils | Redis 操作失败 1/3: get(SceneId.6D63146BE5C84A78B5AB044327BA55BD), 错误: Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
......@@ -14,6 +14,7 @@ public class ProdEquipment implements Serializable {
private Long equipId;
private String equipCode;
private String equipName;
private String capacityTypeName;
private Long resourceId;
private String resourceCode;
private String execId;
......@@ -30,4 +31,4 @@ public class ProdEquipment implements Serializable {
* 准备时间
*/
private int setupTime;
}
\ No newline at end of file
}
......@@ -16,7 +16,9 @@ public class MachineVO {
@Schema(description = "设备名称")
private String equipName;
private String capacityTypeName;
@Schema(description = "任务集合")
private List<GenVO> tasks;
}
\ No newline at end of file
}
......@@ -58,6 +58,8 @@ public class Machine {
*/
private String code;
private String capacityTypeName;
/**
* 节假日列表
*/
......@@ -131,4 +133,4 @@ public class Machine {
public int hashCode() {
return Objects.hash(id);
}
}
\ No newline at end of file
}
......@@ -1963,6 +1963,8 @@ public class GeneticDecoder {
.sorted(Comparator.comparing(Entry::getSequence))
.collect(Collectors.toList());
List<GlobalOperationInfo> entrys=
chromosome.getGlobalOpList().stream().filter(t->t.getOp().getGroupId()==groupId).collect(Collectors.toList());
for (Entry currentOp : orderOps) {
......@@ -1973,15 +1975,20 @@ public class GeneticDecoder {
GlobalOperationInfo global= entrys.stream().
filter(t->t.getOp().getId()==currentOp.getId())
.findFirst().orElse(null);
int globalOpId= global.getGlobalOpId();
int machineSeq= chromosome.getMachineSelection().get(globalOpId);
MachineOption machineOption=
currentOp.getMachineOptions().get(machineSeq-1);
Long machineId = machineOption.getMachineId();
Long machineId = currentOp.getSelectMachineID();
MachineOption machineOption= currentOp.getMachineOptions().stream()
.filter(t->t.getMachineId().equals(machineId)).findFirst().orElse(null);
// MachineOption machineOption= currentOp.getMachineOptions().stream()
// .filter(t->t.getMachineId().equals(machineId)).findFirst().orElse(null);
double processTime = machineOption.getProcessingTime();
OpMachine opMachine=new OpMachine();
opMachine.setGroupId(groupId);
......
package com.aps.service.Algorithm;
import com.aps.common.util.FileHelper;
import com.aps.common.util.ProductionDeepCopyUtil;
import com.aps.entity.Algorithm.*;
import com.aps.entity.basic.Entry;
......@@ -594,47 +595,64 @@ public class GeneticOperations {
return indexWeights.get(CommonCalculator.getOsIndex(indexWeights));
}
public void DelOrder(Chromosome chromosome) {
List<Entry> allOperations = chromosome.getAllOperations();
List<GlobalOperationInfo> globalOpList= chromosome.getGlobalOpList();
if(chromosome.getOrders()==null||chromosome.getOrders().size()==0)
return;
List<Order> orders = chromosome.getOrders();
List<Integer> OperationSequencing= chromosome.getOperationSequencing();
List<Integer> newoorderids= orders.stream()
.filter(t->t.isNewSfCreate())
.map(Order::getId)
.sorted(Comparator.reverseOrder())
.collect(Collectors.toList());
if(newoorderids!=null&&newoorderids.size()>0) {
List<Entry> allOperations = chromosome.getAllOperations();
List<GlobalOperationInfo> globalOpList = chromosome.getGlobalOpList();
List<Integer> OperationSequencing = chromosome.getOperationSequencing();
// log(String.format("半成品订单-删除前,工序: %d,工序序列: %d,设备: %d,设备序列: %d",
// allOperations.size(), OperationSequencing.size(), globalOpList.size(), chromosome.getMachineSelection().size()), true);
for (Integer id : newoorderids) {
List<Entry> sourceOps = allOperations.stream()
.filter(o -> o.getGroupId()==id)
.filter(o -> o.getGroupId() == id)
.sorted(Comparator.comparing(Entry::getSequence))
.collect(Collectors.toList());
for (Entry entry : sourceOps) {
OptionalInt index1 = IntStream.range(0, globalOpList.size())
.filter(h -> entry.getId()==globalOpList.get(h).getOp().getId())
.filter(h -> entry.getId() == globalOpList.get(h).getOp().getId())
.findFirst();
globalOpList.remove((int)index1.orElse(0));
globalOpList.remove((int) index1.orElse(0));
chromosome.getMachineSelection().remove((int)index1.orElse(0));
chromosome.getMachineSelection().remove((int) index1.orElse(0));
}
chromosome.getOperatRel().remove(id-1);
chromosome.getOperatRel().remove(id - 1);
}
allOperations.removeIf(t ->newoorderids.contains(t.getGroupId()));
OperationSequencing.removeIf(t ->newoorderids.contains(t));
allOperations.removeIf(t -> newoorderids.contains(t.getGroupId()));
OperationSequencing.removeIf(t -> newoorderids.contains(t));
AtomicInteger globalOpId = new AtomicInteger(0);
globalOpList.forEach(t-> {
globalOpList.forEach(t -> {
t.setGlobalOpId(globalOpId.getAndIncrement());
});
orders.removeIf(t ->newoorderids.contains(t.getId()));
orders.removeIf(t -> newoorderids.contains(t.getId()));
// log(String.format("半成品订单-删除后,工序: %d,工序序列: %d,设备: %d,设备序列: %d",
// allOperations.size(), OperationSequencing.size(), globalOpList.size(), chromosome.getMachineSelection().size()), true);
//
}
}
private void log(String message, boolean enableLogging) {
if (false ) {
FileHelper.writeLogFile(message);
}
}
......
......@@ -324,6 +324,12 @@ if(entry.getMachineOptions()!=null)
.distinct()
.sorted()
.collect(Collectors.toList());
Map<Long, String> capacityTypeNameByEquipId = ProdEquipments.stream()
.filter(t -> t.getEquipId() != null && t.getCapacityTypeName() != null)
.collect(Collectors.toMap(
ProdEquipment::getEquipId,
ProdEquipment::getCapacityTypeName,
(existing, replacement) -> existing));
List<Machine> machines = new ArrayList<>();
List<PlanResource> PlanResources = _PlanResourceService.lambdaQuery()
......@@ -336,6 +342,7 @@ if(entry.getMachineOptions()!=null)
Machine machine = new Machine();
machine.setId(id);
machine.setCapacityTypeName(capacityTypeNameByEquipId.get(id));
machine.setCode("");
machine.setName("");
......@@ -399,6 +406,9 @@ if(entry.getMachineOptions()!=null)
{
machine.setCode(equipinfo.getEquipId());
machine.setName(equipinfo.getEquipName());
if (machine.getCapacityTypeName() == null) {
machine.setCapacityTypeName(equipinfo.getCapacityTypeName());
}
}else {
machine.setCode(PlanResource.getReferenceCode());
machine.setName(PlanResource.getTitle());
......@@ -457,6 +467,9 @@ if(entry.getMachineOptions()!=null)
{
machine.setCode(equipinfo.getEquipId());
machine.setName(equipinfo.getEquipName());
if (machine.getCapacityTypeName() == null) {
machine.setCapacityTypeName(equipinfo.getCapacityTypeName());
}
}else {
machine.setCode(PlanResource.getReferenceCode());
machine.setName(PlanResource.getTitle());
......@@ -551,6 +564,7 @@ if(entry.getMachineOptions()!=null)
{
machine.setCode(equipinfo.getEquipId());
machine.setName(equipinfo.getEquipName());
machine.setCapacityTypeName(equipinfo.getCapacityTypeName());
}else {
machine.setCode(resource.getReferenceCode());
machine.setName(resource.getTitle());
......@@ -715,6 +729,13 @@ if(entry.getMachineOptions()!=null)
machine.setId(resource.getId());
machine.setCode(resource.getReferenceCode());
machine.setName(resource.getTitle());
Equipinfo equipinfo = _equipinfoService.lambdaQuery()
.eq(Equipinfo::getId, resource.getReferenceId())
.eq(Equipinfo::getIsdeleted, 0)
.one();
if (equipinfo != null) {
machine.setCapacityTypeName(equipinfo.getCapacityTypeName());
}
List<Shift> shifts1 = new ArrayList<>();
......
......@@ -438,6 +438,7 @@ public class ChromosomeDataService {
filteredMachine.setEarliestTime(originalMachine.getEarliestTime());
filteredMachine.setTotalTaskTime(originalMachine.getTotalTaskTime());
filteredMachine.setCode(originalMachine.getCode());
filteredMachine.setCapacityTypeName(originalMachine.getCapacityTypeName());
filteredMachine.setActualWorkTime(originalMachine.getActualWorkTime());
filteredMachine.setRate(originalMachine.getRate());
filteredMachine.setDepartment(originalMachine.getDepartment());
......@@ -1639,6 +1640,7 @@ public class ChromosomeDataService {
filteredMachine.setEarliestTime(originalMachine.getEarliestTime());
filteredMachine.setTotalTaskTime(originalMachine.getTotalTaskTime());
filteredMachine.setCode(originalMachine.getCode());
filteredMachine.setCapacityTypeName(originalMachine.getCapacityTypeName());
filteredMachine.setActualWorkTime(originalMachine.getActualWorkTime());
filteredMachine.setRate(originalMachine.getRate());
filteredMachine.setDepartment(originalMachine.getDepartment());
......
......@@ -2004,12 +2004,32 @@ public class PlanResultService {
//
}
applySceneCapacityTypeName(machines, ProdEquipments);
FileHelper.writeLogFile("初始化设备日历-----------结束-------");
redisUtils.set("machines",machines);
GlobalCacheUtil.put("machines", machines, 10, TimeUnit.MINUTES);
return machines;
}
private void applySceneCapacityTypeName(List<Machine> machines, List<ProdEquipment> prodEquipments) {
if (machines == null || prodEquipments == null || prodEquipments.isEmpty()) {
return;
}
Map<Long, String> capacityTypeNameByEquipId = prodEquipments.stream()
.filter(t -> t.getEquipId() != null && t.getCapacityTypeName() != null)
.collect(Collectors.toMap(
ProdEquipment::getEquipId,
ProdEquipment::getCapacityTypeName,
(existing, replacement) -> existing));
for (Machine machine : machines) {
String capacityTypeName = capacityTypeNameByEquipId.get(machine.getId());
if (capacityTypeName != null) {
machine.setCapacityTypeName(capacityTypeName);
}
}
}
public List<Machine> InitCalendarToAllMachines ()
{
FileHelper.writeLogFile("初始化Redis设备日历-----------开始-------");
......@@ -2751,6 +2771,7 @@ public class PlanResultService {
machineVO.setId(machine.getId());
machineVO.setEquipId(String.valueOf(machine.getId()));
machineVO.setEquipName(machine.getName());
machineVO.setCapacityTypeName(machine.getCapacityTypeName());
// 注意:tasks 字段需要在其他地方设置,因为 Machine 类中没有任务信息
return machineVO;
}
......@@ -2898,8 +2919,7 @@ public class PlanResultService {
}
applySceneCapacityTypeName(machines, ProdEquipments);
return machines;
......@@ -3477,8 +3497,7 @@ public class PlanResultService {
machine.setShifts(shifts1);
}
}
applySceneCapacityTypeName(machines, ProdEquipments);
return machines;
......
......@@ -121,6 +121,7 @@ public class PlanSchedulerService {
machineVO.setId(machine.getId());
machineVO.setEquipId(String.valueOf(machine.getId()));
machineVO.setEquipName(machine.getName());
machineVO.setCapacityTypeName(machine.getCapacityTypeName());
return machineVO;
}
}
\ No newline at end of file
}
......@@ -9,6 +9,7 @@
<id column="RESOURCE_ID" property="resourceId" />
<result column="EQUIP_CODE" property="equipCode" />
<result column="EQUIP_NAME" property="equipName" />
<result column="CAPACITY_TYPE_NAME" property="capacityTypeName" />
<result column="EXEC_ID" property="execId" />
<result column="SPEED" property="speed" />
<result column="ID" property="id" />
......@@ -18,7 +19,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
SCENE_ID, EQUIP_ID, EQUIP_CODE, EQUIP_NAME, RESOURCE_ID, EXEC_ID, SPEED, ID, EFFICIENCY_VALUE, SETUP_TIME
SCENE_ID, EQUIP_ID, EQUIP_CODE, EQUIP_NAME, CAPACITY_TYPE_NAME, RESOURCE_ID, EXEC_ID, SPEED, ID, EFFICIENCY_VALUE, SETUP_TIME
</sql>
</mapper>
\ No newline at end of file
</mapper>
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