|
@@ -1,11 +1,18 @@
|
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
|
|
|
import com.rongwei.bscommon.sys.dao.ApsProcessOperationProcessEquDao;
|
|
|
+import com.rongwei.bscommon.sys.service.ApsProcessOperationService;
|
|
|
import com.rongwei.bscommon.sys.service.GanttService;
|
|
|
+import com.rongwei.bsentity.domain.ApsProcessOperationDo;
|
|
|
import com.rongwei.bsentity.vo.GanttVos;
|
|
|
import com.rongwei.bsentity.vo.ScheduleGanttVo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
+import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -48,6 +55,9 @@ public class GanttServiceImpl implements GanttService {
|
|
|
public static final String DEFAULT_TYPE = "project";
|
|
|
public static final String DEFAULT_RENDER = "split";
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ApsProcessOperationService apsProcessOperationService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件获取gantt
|
|
|
*
|
|
@@ -69,7 +79,8 @@ public class GanttServiceImpl implements GanttService {
|
|
|
searchDateList==null?null:searchDateList.get(1),
|
|
|
factoryId,
|
|
|
workShopIdList,
|
|
|
- orderNoList);
|
|
|
+ orderNoList,
|
|
|
+ null);
|
|
|
// 需要返回给前端的数据
|
|
|
List<ScheduleGanttVo> resultVo = new ArrayList<>();
|
|
|
if (apsProcessOperationProcessEquDos.isEmpty()) {
|
|
@@ -252,4 +263,48 @@ public class GanttServiceImpl implements GanttService {
|
|
|
returnDate.add(Date.from(sixDaysLaterEnd.atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
return returnDate;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查找上一个或者下一个工序节点
|
|
|
+ * @param ganttVosList
|
|
|
+ * @param operatorType next:下一节点,pre:上一节点
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<GanttVos> getNextProcess(List<GanttVos> ganttVosList,String operatorType){
|
|
|
+ List<GanttVos> retGantvos = null;
|
|
|
+ // 获取下一个或者上一个工序
|
|
|
+ if(ganttVosList != null && ganttVosList.size()>0){
|
|
|
+ List<String> processids = ganttVosList.stream().map(v->v.getProcessid()).collect(Collectors.toList());
|
|
|
+ // 获取上一节点或者下一节点
|
|
|
+ List<ApsProcessOperationDo> processOperations = apsProcessOperationService.list(new LambdaQueryWrapper<ApsProcessOperationDo>()
|
|
|
+ .in(ApsProcessOperationDo::getId, processids));
|
|
|
+ List<String> queryProcessids = new ArrayList<>();
|
|
|
+ if(processOperations != null && processOperations.size()>0){
|
|
|
+ for (ApsProcessOperationDo processOperation : processOperations) {
|
|
|
+ if("next".equals(operatorType)){
|
|
|
+ if(processOperation.getNextprocessid() != null){
|
|
|
+ queryProcessids.addAll(Arrays.asList(processOperation.getNextprocessid().split(",")));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(processOperation.getPreviousprocessid() != null){
|
|
|
+ queryProcessids.addAll(Arrays.asList(processOperation.getPreviousprocessid().split(",")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(queryProcessids != null && queryProcessids.size()>0){
|
|
|
+ String joinids = "'" + CollUtil.join(queryProcessids, "','") + "'";
|
|
|
+ retGantvos = apsProcessOperationProcessEquDao.getGanttDataList(
|
|
|
+ null,null,null,null,null,joinids);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ if("next".equals(operatorType)){
|
|
|
+ throw new CustomException("没有下一工序");
|
|
|
+ }else{
|
|
|
+ throw new CustomException("没有上一工序");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retGantvos;
|
|
|
+ }
|
|
|
}
|