|
|
|
|
@ -39,6 +39,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.security.auth.x500.X500Principal; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
@ -863,6 +864,73 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
return url; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<DsProcessProjectEntity> selectDsProcessProjectByCraftId(Long craftId) { |
|
|
|
|
//参数校验
|
|
|
|
|
if (craftId == null) { |
|
|
|
|
log.warn("工艺ID为空"); |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询工艺信息
|
|
|
|
|
DsCraftEntity craft = craftService.getById(craftId); |
|
|
|
|
if (craft == null) { |
|
|
|
|
log.warn("工艺不存在, craftId: {}", craftId); |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取工艺对应的工序ID列表
|
|
|
|
|
List<Long> processIdList = getProcessIdListByCraft(craft); |
|
|
|
|
if (CollectionUtils.isEmpty(processIdList)) { |
|
|
|
|
log.info("未找到工序ID, craftId: {}, reworkOrder: {}", craftId, craft.getReworkOrder()); |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询工序项目
|
|
|
|
|
return processProjectService.selectDsProcessProjectByProcessIds(processIdList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据工艺获取工序ID列表(支持返工工艺和正常工艺) |
|
|
|
|
*/ |
|
|
|
|
private List<Long> getProcessIdListByCraft(DsCraftEntity craft) { |
|
|
|
|
if (craft == null) { |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean isRework = !StringUtils.isEmpty(craft.getReworkOrder()); |
|
|
|
|
|
|
|
|
|
if (isRework) { |
|
|
|
|
// 返工工艺:从返工工序表查询
|
|
|
|
|
List<PrReworkProcessEntity> reworkProcessList = prReworkProcessService.selectPrReworkProcess( |
|
|
|
|
craft.getReworkOrder(), |
|
|
|
|
craft.getPartCode(), |
|
|
|
|
craft.getPartVersions() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return Optional.ofNullable(reworkProcessList) |
|
|
|
|
.orElse(Collections.emptyList()) |
|
|
|
|
.stream() |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.map(PrReworkProcessEntity::getId) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.distinct() |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
} else { |
|
|
|
|
// 正常工艺:从工序表查询
|
|
|
|
|
List<DsProcessEntity> processList = processService.selectDsProcessByCraftId(craft.getId()); |
|
|
|
|
|
|
|
|
|
return Optional.ofNullable(processList) |
|
|
|
|
.orElse(Collections.emptyList()) |
|
|
|
|
.stream() |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.map(DsProcessEntity::getId) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.distinct() |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 创建维护任务 |
|
|
|
|
*/ |
|
|
|
|
|