工艺提供接口

liweidong
liweidong-hj 5 days ago
parent f2207b75dc
commit 4602582228
  1. 1
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/mapper/CraftMapper.xml
  2. 10
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/IDsPartService.java
  3. 68
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/impl/DsPartServiceImpl.java

@ -66,6 +66,7 @@
select * from DS_CRAFT where is_deleted = 0
and PART_ID = #{partId}
and RANK = #{rank}
and REWORK_ORDER is null
</select>
<select id="getPartCraft" resultType="org.springblade.desk.dashboard.pojo.entity.DsCraftEntity">

@ -222,7 +222,7 @@ public interface IDsPartService extends BaseService<DsPartEntity> {
List<DsPartEntity> selectDsPartByPatCode(String partCode);
/**
* 根据零件号工序ID版本号工艺级别查询对应的检验项目
* 根据零件号工序ID版本号工艺级别查询对应的检验项目(不包含返工)
* @param partCode 零件号
* @param orders 工序编号
* @param partVersion 版本号
@ -295,4 +295,12 @@ public interface IDsPartService extends BaseService<DsPartEntity> {
* @return
*/
String openPdmDrawing(String partCode);
/**
* 根据工艺ID查询检验项目
* @param creatId
* @return
*/
List<DsProcessProjectEntity> selectDsProcessProjectByCraftId(Long creatId);
}

@ -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());
}
}
/**
* 创建维护任务
*/

Loading…
Cancel
Save