|
@@ -25,6 +25,8 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
@@ -166,13 +168,13 @@ public class GanttServiceImpl implements GanttService {
|
|
|
log.error("无法获取当前排程用户信息");
|
|
|
return R.ok("");
|
|
|
}
|
|
|
- String returnMsg="";
|
|
|
+ String returnMsg = "";
|
|
|
//正在排程直接返回
|
|
|
if (rLock.isLocked()) {
|
|
|
returnMsg = String.format(SCHEDULING_STR, sysUserVo.getName(), "正在排程", "");
|
|
|
} else {
|
|
|
if (StringUtils.isNotBlank(sysUserVo.getRoption())) {
|
|
|
- returnMsg = String.format(SCHEDULING_STR, sysUserVo.getName(),"排程异常" ,":" + sysUserVo.getRoption());
|
|
|
+ returnMsg = String.format(SCHEDULING_STR, sysUserVo.getName(), "排程异常", ":" + sysUserVo.getRoption());
|
|
|
} else {
|
|
|
returnMsg = String.format(SCHEDULING_STR, sysUserVo.getName(), "排程结束", "");
|
|
|
}
|
|
@@ -365,7 +367,7 @@ public class GanttServiceImpl implements GanttService {
|
|
|
LinkedHashMap<String, List<GanttVos>> processMap = apsProcessOperationProcessEquDos.stream().collect(Collectors.groupingBy(GanttVos::getProcessdeviceid,
|
|
|
LinkedHashMap::new, Collectors.toList()));
|
|
|
for (Map.Entry<String, List<GanttVos>> deviceEntry : processMap.entrySet()) {
|
|
|
- List<GanttVos> values= deviceEntry.getValue();
|
|
|
+ List<GanttVos> values = deviceEntry.getValue();
|
|
|
values.sort(Comparator.comparing(GanttVos::getPlanstartdate).thenComparing(GanttVos::getPlanenddate));
|
|
|
// 对数据按照 计划开始时间 分组
|
|
|
LinkedHashMap<String, List<GanttVos>> planDataMap = values.stream().collect(Collectors.groupingBy(info -> {
|
|
@@ -390,22 +392,22 @@ public class GanttServiceImpl implements GanttService {
|
|
|
List<GanttVos> noNullActualDateList = ganttVos.stream()
|
|
|
.filter(g -> g.getActualstartdate() != null)
|
|
|
.collect(Collectors.toList());
|
|
|
- if (!noNullActualDateList.isEmpty()){
|
|
|
+ if (!noNullActualDateList.isEmpty()) {
|
|
|
//取出最早实际开工时间
|
|
|
Optional<GanttVos> minDate = noNullActualDateList.stream()
|
|
|
.min(Comparator.comparing(GanttVos::getActualstartdate));
|
|
|
- if(minDate.get().getActualstartdate()!= null){
|
|
|
+ if (minDate.get().getActualstartdate() != null) {
|
|
|
actualStartDate = minDate.get().getActualstartdate();
|
|
|
}
|
|
|
}
|
|
|
//查询实际完工时间为空的列表
|
|
|
List<GanttVos> nullActualFinishDateList = ganttVos.stream().filter(g -> g.getActualfinishdate() == null)
|
|
|
.collect(Collectors.toList());
|
|
|
- if (nullActualFinishDateList.isEmpty()){
|
|
|
+ if (nullActualFinishDateList.isEmpty()) {
|
|
|
//取出最晚实际完工时间
|
|
|
Optional<GanttVos> maxDate = ganttVos.stream()
|
|
|
.max(Comparator.comparing(GanttVos::getActualfinishdate));
|
|
|
- if(maxDate.isPresent()&&maxDate.get().getActualfinishdate()!= null){
|
|
|
+ if (maxDate.isPresent() && maxDate.get().getActualfinishdate() != null) {
|
|
|
actualFinishDate = maxDate.get().getActualfinishdate();
|
|
|
}
|
|
|
}
|
|
@@ -419,7 +421,7 @@ public class GanttServiceImpl implements GanttService {
|
|
|
List<GanttVos> filteredWorkStatus = ganttVos.stream()
|
|
|
.filter(g -> g.getWorkstatus() != null && !g.getWorkstatus().isEmpty())
|
|
|
.collect(Collectors.toList());
|
|
|
- if (!filteredWorkStatus.isEmpty()){
|
|
|
+ if (!filteredWorkStatus.isEmpty()) {
|
|
|
GanttVos minWorkStatus = (filteredWorkStatus.stream()
|
|
|
.min(Comparator.comparingInt(p -> keyValueMap.get(p.getWorkstatus())))
|
|
|
.orElse(null));
|
|
@@ -429,15 +431,27 @@ public class GanttServiceImpl implements GanttService {
|
|
|
String finalWorkStatus = workstatus;
|
|
|
Date finalActualStartDate = actualStartDate;
|
|
|
Date finalActualFinishDate = actualFinishDate;
|
|
|
- ganttVos.forEach(item -> {
|
|
|
- if ("20".equals(item.getProcessstatus())){
|
|
|
+ String heji = "";
|
|
|
+ BigDecimal allTotalWeight = BigDecimal.ZERO;
|
|
|
+ boolean needHeji = false;
|
|
|
+ if (ganttVos.get(0).getProcessway().equals("合并加工")) {
|
|
|
+ needHeji = true;
|
|
|
+ }
|
|
|
+ for (GanttVos item : ganttVos) {
|
|
|
+ if ("20".equals(item.getProcessstatus())) {
|
|
|
item.setGanttprocessstatus(TO_BE_PUBLISHED);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
item.setGanttprocessstatus(GANTT_PROCESS_STATUS_MAP.getOrDefault(finalWorkStatus, ""));
|
|
|
}
|
|
|
item.setActualstartdate(finalActualStartDate);
|
|
|
item.setActualfinishdate(finalActualFinishDate);
|
|
|
- });
|
|
|
+ if (needHeji) {
|
|
|
+ allTotalWeight = allTotalWeight.add(item.getTotalRollWeight());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (needHeji) {
|
|
|
+ heji = "合计:" + allTotalWeight.setScale(2, RoundingMode.HALF_UP) + "吨";
|
|
|
+ }
|
|
|
// List<String> itemNames = new ArrayList<>();
|
|
|
// 按照工序作业明细ID 进行分组 并且获取 图列的 名称和描述
|
|
|
// LinkedHashMap<String, List<GanttVos>> collect = ganttVos.stream().collect(Collectors.groupingBy(GanttVos::getId, LinkedHashMap::new, Collectors.toList()));
|
|
@@ -465,7 +479,7 @@ public class GanttServiceImpl implements GanttService {
|
|
|
dateVo.setWorkstatus(ganttVos.stream().map(GanttVos::getWorkstatus).distinct().collect(Collectors.joining(",")));
|
|
|
dateVo.setLockmark(ganttVos.stream().map(GanttVos::getLockmark).distinct().collect(Collectors.joining(",")));
|
|
|
dateVo.setProductionorderid(ganttVos.stream().map(GanttVos::getProductionorderid).collect(Collectors.joining(",")));
|
|
|
- dateVo.setPlanhavematerialdate( ganttVos.stream().filter(data -> data.getPlanhavematerialdate() != null)
|
|
|
+ dateVo.setPlanhavematerialdate(ganttVos.stream().filter(data -> data.getPlanhavematerialdate() != null)
|
|
|
.max(Comparator.comparing(GanttVos::getPlanhavematerialdate))
|
|
|
.map(GanttVos::getPlanhavematerialdate).orElse(null));
|
|
|
// 冲突描述
|
|
@@ -477,6 +491,7 @@ public class GanttServiceImpl implements GanttService {
|
|
|
// 有冲突描述时
|
|
|
dateVo.setConflict(StringUtils.isBlank(dateVo.getConflictdes()) && StringUtils.isBlank(dateVo.getSoftconflictdes()));
|
|
|
}
|
|
|
+ dateVo.setTotalDesc(heji);
|
|
|
resultVo.add(dateVo);
|
|
|
}
|
|
|
}
|