|
@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.rongwei.bscommon.sys.dao.ApsProcessOperationBackupDao;
|
|
@@ -375,67 +374,68 @@ public class ApsProcessOperationProcessEquServiceImpl extends ServiceImpl<ApsPro
|
|
|
/**
|
|
|
* 工序作业明细更新 计划开始和计划结束时间
|
|
|
*
|
|
|
- * @param changeStartTimeVo
|
|
|
+ * @param changeStartTimeVos
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public R changeStartTime(ChangeStartTimeVo changeStartTimeVo) {
|
|
|
- String id = changeStartTimeVo.getId();
|
|
|
- ApsProcessOperationProcessEquDo processEquDo = this.getById(id);
|
|
|
- ApsProcessOperationDo operationDo = apsProcessOperationService.getById(processEquDo.getProcessid());
|
|
|
- if (operationDo == null) {
|
|
|
- log.error("无法通过ID:{}获取到坯料计划", processEquDo.getBlankid());
|
|
|
- return R.error("无法获取到坯料计划信息");
|
|
|
- }
|
|
|
- if (Arrays.asList(COMPLETED, PROCESSING, TO_BE_STARTED).contains(operationDo.getProcessstatus())) {
|
|
|
- log.error("该作业已发布,不能调整开工时间");
|
|
|
- return R.error("该作业已发布,不能调整开工时间");
|
|
|
- }
|
|
|
- // 获取更新之前的存在冲突的工序作业
|
|
|
- List<ApsProcessOperationProcessEquDo> beforeUpdatingConflictId = this.baseMapper.getConflictId(changeStartTimeVo.getQeuId(), changeStartTimeVo.getId(),
|
|
|
- changeStartTimeVo.getPlanStartTime(), changeStartTimeVo.getPlanEndTime());
|
|
|
-
|
|
|
-
|
|
|
- // 找到更新时间之后存在冲突的工序作业
|
|
|
- List<ApsProcessOperationProcessEquDo> afterTheUpdateConflictId = this.baseMapper.getConflictId(changeStartTimeVo.getQeuId(), changeStartTimeVo.getId(),
|
|
|
- changeStartTimeVo.getPlanStartTime(), changeStartTimeVo.getPlanEndTime());
|
|
|
- if (!beforeUpdatingConflictId.isEmpty()) {
|
|
|
- beforeUpdatingConflictId.forEach(info->{
|
|
|
- String conflictdes = info.getConflictdes();
|
|
|
- if(StringUtils.isNotBlank(conflictdes)){
|
|
|
- List<String> conflictdeList = new ArrayList<>(Arrays.asList(conflictdes.split(",")));
|
|
|
- // 删除加工时间冲突描述
|
|
|
- conflictdeList.remove(CONFLICTING_PROCESSING_TIMES);
|
|
|
- if(conflictdeList.isEmpty()){
|
|
|
- info.setHasconflict(LOCKMARK_N);
|
|
|
+ public R changeStartTime(List<ChangeStartTimeVo> changeStartTimeVos) {
|
|
|
+ changeStartTimeVos.forEach(changeStartTimeVo -> {
|
|
|
+ String id = changeStartTimeVo.getId();
|
|
|
+ ApsProcessOperationProcessEquDo processEquDo = this.getById(id);
|
|
|
+ ApsProcessOperationDo operationDo = apsProcessOperationService.getById(processEquDo.getProcessid());
|
|
|
+ if (operationDo == null) {
|
|
|
+ log.error("无法通过ID:{}获取到坯料计划", processEquDo.getBlankid());
|
|
|
+ throw new RuntimeException("无法获取到坯料计划信息");
|
|
|
+ }
|
|
|
+ if (Arrays.asList(COMPLETED, PROCESSING, TO_BE_STARTED).contains(operationDo.getProcessstatus())) {
|
|
|
+ log.error("该作业已发布,不能调整开工时间");
|
|
|
+ throw new RuntimeException("该作业已发布,不能调整开工时间");
|
|
|
+ }
|
|
|
+ // 获取更新之前的存在冲突的工序作业
|
|
|
+ List<ApsProcessOperationProcessEquDo> beforeUpdatingConflictId = this.baseMapper.getConflictId(changeStartTimeVo.getQeuId(), changeStartTimeVo.getId(),
|
|
|
+ changeStartTimeVo.getPlanStartTime(), changeStartTimeVo.getPlanEndTime());
|
|
|
+
|
|
|
+ // 找到更新时间之后存在冲突的工序作业
|
|
|
+ List<ApsProcessOperationProcessEquDo> afterTheUpdateConflictId = this.baseMapper.getConflictId(changeStartTimeVo.getQeuId(), changeStartTimeVo.getId(),
|
|
|
+ changeStartTimeVo.getPlanStartTime(), changeStartTimeVo.getPlanEndTime());
|
|
|
+ if (!beforeUpdatingConflictId.isEmpty()) {
|
|
|
+ beforeUpdatingConflictId.forEach(info->{
|
|
|
+ String conflictdes = info.getConflictdes();
|
|
|
+ if(StringUtils.isNotBlank(conflictdes)){
|
|
|
+ List<String> conflictdeList = new ArrayList<>(Arrays.asList(conflictdes.split(",")));
|
|
|
+ // 删除加工时间冲突描述
|
|
|
+ conflictdeList.remove(CONFLICTING_PROCESSING_TIMES);
|
|
|
+ if(conflictdeList.isEmpty()){
|
|
|
+ info.setHasconflict(LOCKMARK_N);
|
|
|
+ }
|
|
|
+ info.setConflictdes(CollUtil.join(conflictdeList, ","));
|
|
|
}
|
|
|
- info.setConflictdes(CollUtil.join(conflictdeList, ","));
|
|
|
- }
|
|
|
- });
|
|
|
- this.updateBatchById(beforeUpdatingConflictId);
|
|
|
- }
|
|
|
- if (!afterTheUpdateConflictId.isEmpty()) {
|
|
|
- processEquDo.setHasconflict(LOCKMARK_Y);
|
|
|
- processEquDo.setConflictdes(CONFLICTING_PROCESSING_TIMES);
|
|
|
- afterTheUpdateConflictId.forEach(info->{
|
|
|
- info.setHasconflict(LOCKMARK_Y);
|
|
|
- String conflictdes = info.getConflictdes();
|
|
|
- if(StringUtils.isNotBlank(conflictdes)){
|
|
|
- List<String> conflictdeList = new ArrayList<>(Arrays.asList(conflictdes.split(",")));
|
|
|
- if(!conflictdeList.contains(CONFLICTING_PROCESSING_TIMES)){
|
|
|
- conflictdeList.add(CONFLICTING_PROCESSING_TIMES);
|
|
|
+ });
|
|
|
+ this.updateBatchById(beforeUpdatingConflictId);
|
|
|
+ }
|
|
|
+ if (!afterTheUpdateConflictId.isEmpty()) {
|
|
|
+ processEquDo.setHasconflict(LOCKMARK_Y);
|
|
|
+ processEquDo.setConflictdes(CONFLICTING_PROCESSING_TIMES);
|
|
|
+ afterTheUpdateConflictId.forEach(info->{
|
|
|
+ info.setHasconflict(LOCKMARK_Y);
|
|
|
+ String conflictdes = info.getConflictdes();
|
|
|
+ if(StringUtils.isNotBlank(conflictdes)){
|
|
|
+ List<String> conflictdeList = new ArrayList<>(Arrays.asList(conflictdes.split(",")));
|
|
|
+ if(!conflictdeList.contains(CONFLICTING_PROCESSING_TIMES)){
|
|
|
+ conflictdeList.add(CONFLICTING_PROCESSING_TIMES);
|
|
|
+ }
|
|
|
+ info.setConflictdes(CollUtil.join(conflictdeList, ","));
|
|
|
+ } else {
|
|
|
+ info.setConflictdes(CONFLICTING_PROCESSING_TIMES);
|
|
|
}
|
|
|
- info.setConflictdes(CollUtil.join(conflictdeList, ","));
|
|
|
- }else {
|
|
|
- info.setConflictdes(CONFLICTING_PROCESSING_TIMES);
|
|
|
- }
|
|
|
- });
|
|
|
- this.updateBatchById(afterTheUpdateConflictId);
|
|
|
- }
|
|
|
- processEquDo.setPlanstartdate(changeStartTimeVo.getPlanStartTime());
|
|
|
- processEquDo.setPlanenddate(changeStartTimeVo.getPlanEndTime());
|
|
|
- this.updateById(processEquDo);
|
|
|
+ });
|
|
|
+ this.updateBatchById(afterTheUpdateConflictId);
|
|
|
+ }
|
|
|
+ processEquDo.setPlanstartdate(changeStartTimeVo.getPlanStartTime());
|
|
|
+ processEquDo.setPlanenddate(changeStartTimeVo.getPlanEndTime());
|
|
|
+ this.updateById(processEquDo);
|
|
|
+ });
|
|
|
return R.ok();
|
|
|
}
|
|
|
|