Commit 4d1991b5 authored by DESKTOP-VKRD9QF\Administration's avatar DESKTOP-VKRD9QF\Administration

Merge branch 'jdt'

# Conflicts:
#	src/main/resources/application.yml
parents 5cd21818 48b0ff56
...@@ -17,7 +17,7 @@ public class Shift { ...@@ -17,7 +17,7 @@ public class Shift {
private LocalDateTime endDate; private LocalDateTime endDate;
private boolean isTemporaryShift; private boolean isTemporaryShift;
private int priority; private int priority;
private boolean isSpecial;
private Integer status;//0:正常班次 1:临时班次 2:维修 private Integer status;//0:正常班次 1:临时班次 2:维修
// 添加设备ID和名称字段 // 添加设备ID和名称字段
......
...@@ -130,7 +130,7 @@ public class LanuchServiceImpl implements LanuchService { ...@@ -130,7 +130,7 @@ public class LanuchServiceImpl implements LanuchService {
// 发生任何异常都应回滚事务 // 发生任何异常都应回滚事务
// 如果sceneId已经创建但在事务完成前发生异常,则事务回滚会自动清理数据 // 如果sceneId已经创建但在事务完成前发生异常,则事务回滚会自动清理数据
log.error("场景生成过程中发生异常,事务将回滚", e); log.error("场景生成过程中发生异常,事务将回滚", e);
throw e; // 重新抛出异常以触发事务回滚 throw new RuntimeException("场景生成失败"); // 重新抛出异常以触发事务回滚
} }
} }
...@@ -762,8 +762,7 @@ public class LanuchServiceImpl implements LanuchService { ...@@ -762,8 +762,7 @@ public class LanuchServiceImpl implements LanuchService {
LambdaQueryWrapper<RoutingDetailConnect> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<RoutingDetailConnect> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(RoutingDetailConnect::getRoutingHeaderId, prodOrderMain.getRoutingId()) wrapper.eq(RoutingDetailConnect::getRoutingHeaderId, prodOrderMain.getRoutingId())
.eq(RoutingDetailConnect::getIsdeleted, 0) .eq(RoutingDetailConnect::getIsdeleted, 0)
.isNotNull(RoutingDetailConnect::getSourceoperationid) // 添加 sourceoperationid 不为 null 的过滤条件 .isNotNull(RoutingDetailConnect::getSourceoperationid); // 添加 sourceoperationid 不为 null 的过滤条件
.isNotNull(RoutingDetailConnect::getSourceoperation);
List<RoutingDetailConnect> connections = routingDetailConnectService.list(wrapper); List<RoutingDetailConnect> connections = routingDetailConnectService.list(wrapper);
return connections.stream() return connections.stream()
...@@ -789,11 +788,20 @@ public class LanuchServiceImpl implements LanuchService { ...@@ -789,11 +788,20 @@ public class LanuchServiceImpl implements LanuchService {
String sceneId, String sceneId,
Map<Long, String> routingDetailIdToExecIdMap) { Map<Long, String> routingDetailIdToExecIdMap) {
ProdOrderProcess prodOrderProcess = new ProdOrderProcess(); ProdOrderProcess prodOrderProcess = new ProdOrderProcess();
// 根据connection.getSourceoperationid()去routing_detail表查taskSeq
prodOrderProcess.setTaskSeq(getTaskSeqFromRoutingDetail(connection.getSourceoperationid(), connection.getSourceoperation()));
// 根据connection.getDestoperationid()去routing_detail表查targetTaskSeq
prodOrderProcess.setTargetTaskSeq(getTaskSeqFromRoutingDetail(connection.getDestoperationid(), connection.getDestoperation()));
prodOrderProcess.setSceneId(sceneId); prodOrderProcess.setSceneId(sceneId);
prodOrderProcess.setOrderId(prodOrderMain.getOrderId()); prodOrderProcess.setOrderId(prodOrderMain.getOrderId());
prodOrderProcess.setTaskSeq(connection.getSourceoperation()); // prodOrderProcess.setTaskSeq(connection.getSourceoperation());
prodOrderProcess.setTargetOrderId(prodOrderMain.getOrderId()); prodOrderProcess.setTargetOrderId(prodOrderMain.getOrderId());
prodOrderProcess.setTargetTaskSeq(connection.getDestoperation()); // prodOrderProcess.setTargetTaskSeq(connection.getDestoperation());
prodOrderProcess.setId(String.valueOf(SnowFlackIdWorker.getId())); prodOrderProcess.setId(String.valueOf(SnowFlackIdWorker.getId()));
String execId = routingDetailIdToExecIdMap.get(connection.getSourceoperationid()); String execId = routingDetailIdToExecIdMap.get(connection.getSourceoperationid());
...@@ -801,14 +809,10 @@ public class LanuchServiceImpl implements LanuchService { ...@@ -801,14 +809,10 @@ public class LanuchServiceImpl implements LanuchService {
if (execId != null) { if (execId != null) {
prodOrderProcess.setExecId(execId); prodOrderProcess.setExecId(execId);
}else {
prodOrderProcess.setExecId("ttt");
} }
if (targetExecId != null) { if (targetExecId != null) {
prodOrderProcess.setTargetExecId(targetExecId); prodOrderProcess.setTargetExecId(targetExecId);
}else {
prodOrderProcess.setTargetExecId("ttt");
} }
return prodOrderProcess; return prodOrderProcess;
...@@ -826,6 +830,33 @@ public class LanuchServiceImpl implements LanuchService { ...@@ -826,6 +830,33 @@ public class LanuchServiceImpl implements LanuchService {
◦ @return 处理后的值 ◦ @return 处理后的值
*/
/**
* 根据routingDetailId获取taskSeq
* @param routingDetailId routing_detail表的id
* @param defaultTaskSeq 默认taskSeq值
* @return taskSeq字符串
*/
private String getTaskSeqFromRoutingDetail(Long routingDetailId, String defaultTaskSeq) {
if (defaultTaskSeq==null) {
if (routingDetailId != null) {
RoutingDetail routingDetail = routingDetailMapper.selectById(routingDetailId);
if (routingDetail != null && routingDetail.getTaskSeq() != null) {
return String.valueOf(routingDetail.getTaskSeq());
}
}
}
return defaultTaskSeq;
}
/**
* 如果值为null或空白,返回默认值
*
* @param value 原始值
* @param defaultValue 默认值
* @param <T> 类型
* @return 处理后的值
*/ */
private <T> T defaultIfBlank(T value, T defaultValue) { private <T> T defaultIfBlank(T value, T defaultValue) {
if (value == null) { if (value == null) {
......
...@@ -1146,6 +1146,7 @@ private GlobalParam InitGlobalParam() ...@@ -1146,6 +1146,7 @@ private GlobalParam InitGlobalParam()
for (Shift shift : Shifts) { for (Shift shift : Shifts) {
shift.setMachineId(machine.getId()); shift.setMachineId(machine.getId());
shift.setSpecial(true);
shift.setStartDate(machineProdEquipSpecialCal.getStartDate()); shift.setStartDate(machineProdEquipSpecialCal.getStartDate());
shift.setEndDate(machineProdEquipSpecialCal.getEndDate()); shift.setEndDate(machineProdEquipSpecialCal.getEndDate());
shifts1.add(shift); shifts1.add(shift);
...@@ -1156,7 +1157,7 @@ private GlobalParam InitGlobalParam() ...@@ -1156,7 +1157,7 @@ private GlobalParam InitGlobalParam()
List<PlanResource> PlanResources1 = PlanResources.stream() List<PlanResource> PlanResources1 = PlanResources.stream()
.filter(t -> t.getReferenceId() == machine.getId()) .filter(t -> t.getReferenceId() == machine.getId())
.collect(Collectors.toList()); .collect(Collectors.toList());
if(PlanResources1!=null&&PlanResources1.size()>0&&shifts1==null) if(PlanResources1!=null&&PlanResources1.size()>0)
{ {
for (PlanResource PlanResource : PlanResources1) { for (PlanResource PlanResource : PlanResources1) {
...@@ -1165,10 +1166,10 @@ private GlobalParam InitGlobalParam() ...@@ -1165,10 +1166,10 @@ private GlobalParam InitGlobalParam()
.collect(Collectors.toList()); .collect(Collectors.toList());
List<Shift> Shifts = mergeShiftData(ShiftWorkScheds); List<Shift> Shifts = mergeShiftData(ShiftWorkScheds);
for (Shift shift : Shifts) { for (Shift shift : Shifts) {
shift.setSpecial(false);
shift.setMachineId(machine.getId()); shift.setMachineId(machine.getId());
shift.setStartDate(LocalDateTime.of(2000, 1, 1, 0, 0, 0)); // shift.setStartDate(LocalDateTime.of(2000, 1, 1, 0, 0, 0));
shift.setEndDate(LocalDateTime.of(2000, 1, 1, 0, 0, 0)); // shift.setEndDate(LocalDateTime.of(2000, 1, 1, 0, 0, 0));
shifts1.add(shift); shifts1.add(shift);
} }
} }
...@@ -1188,14 +1189,18 @@ private GlobalParam InitGlobalParam() ...@@ -1188,14 +1189,18 @@ private GlobalParam InitGlobalParam()
firstShift.setEndTime(LocalTime.of(23, 59, 59)); // 23:59:59代替24:00 firstShift.setEndTime(LocalTime.of(23, 59, 59)); // 23:59:59代替24:00
firstShift.setDays(new HashSet<>(shift.getDays())); firstShift.setDays(new HashSet<>(shift.getDays()));
firstShift.setStatus(shift.getStatus()); firstShift.setStatus(shift.getStatus());
firstShift.setStartDate(shift.getStartDate());
firstShift.setEndDate(shift.getEndDate());
firstShift.setSpecial(shift.isSpecial());
// 创建第二天的班次 (00:00到结束时间) // 创建第二天的班次 (00:00到结束时间)
Shift secondShift = new Shift(); Shift secondShift = new Shift();
secondShift.setStartTime(LocalTime.MIDNIGHT); secondShift.setStartTime(LocalTime.MIDNIGHT);
secondShift.setEndTime(shift.getEndTime()); secondShift.setEndTime(shift.getEndTime());
secondShift.setDays(new HashSet<>(shift.getDays())); secondShift.setDays(new HashSet<>(shift.getDays()));
secondShift.setStatus(shift.getStatus()); secondShift.setStatus(shift.getStatus());
secondShift.setStartDate(shift.getStartDate().plusDays(1));
secondShift.setEndDate(shift.getEndDate().plusDays(1));
secondShift.setSpecial(shift.isSpecial());
result.add(firstShift); result.add(firstShift);
result.add(secondShift); result.add(secondShift);
} else { } else {
......
...@@ -12,7 +12,7 @@ spring: ...@@ -12,7 +12,7 @@ spring:
redis: redis:
host: 39.100.88.40 host: 39.100.88.40
port: 6379 port: 6379
timeout: 120000 timeout: 10000
database: 10 database: 10
password: redis@228! password: redis@228!
# Swagger 配置 # Swagger 配置
......
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