工艺修改

master
liweidong-hj 1 month ago
parent 1007c03ca4
commit 457cadfb03
  1. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/controller/DsTaskingController.java
  2. 7
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/mapper/CraftMapper.xml
  3. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/mapper/DsCraftMapper.java
  4. 41
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/mapper/PartMapper.xml
  5. 1
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/mapper/ReworkProcessMapper.xml
  6. 11
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/IDsCraftService.java
  7. 3
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/IDsPartService.java
  8. 9
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/impl/DsCraftServiceImpl.java
  9. 30
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/impl/DsPartServiceImpl.java
  10. 293
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/impl/DsTaskingServiceImpl.java
  11. 2
      blade-service/blade-desk/src/main/java/org/springblade/desk/dashboard/service/impl/PrReworkProcessServiceImpl.java
  12. 2
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/WorkOrderServiceImpl.java

@ -404,9 +404,9 @@ public class DsTaskingController extends BladeController {
/**
* 零件信息表 详情-工艺详情
*/
@GetMapping("/syncTasking")
@GetMapping("/syncTasking")
public R craftDetail() {
boolean b = dsTaskingService.syncTasking();
boolean b = dsTaskingService.reworkTask();
return R.data(b);
}

@ -72,6 +72,7 @@
select * from DS_CRAFT where is_deleted = 0
and PART_ID = #{partId}
and RANK = #{rank}
and ROAM_NO = #{roamNo}
</select>
<select id="getReworkCraft" resultType="org.springblade.desk.dashboard.pojo.entity.DsCraftEntity">
@ -97,5 +98,11 @@
select * from DS_CRAFT where is_deleted = 0
and REWORK_ORDER = #{changeNo}
</select>
<select id="selectDsCraftByPartIdAndRank"
resultType="org.springblade.desk.dashboard.pojo.entity.DsCraftEntity">
select * from DS_CRAFT where is_deleted = 0
and PART_ID = #{partId}
and RANK = #{rank}
</select>
</mapper>

@ -71,7 +71,7 @@ public interface DsCraftMapper extends BaseMapper<DsCraftEntity> {
List<DsCraftVO> selectCraft(@Param("partId")Long partId,@Param("rank")String rank);
DsCraftEntity getPartCraft(@Param("partId")Long partId, @Param("rank")String rank);
DsCraftEntity getPartCraft(@Param("partId")Long partId, @Param("rank")String rank,@Param("roamNo") String roamNo);
DsCraftEntity getReworkCraft(@Param("partId")Long partId,@Param("changeNo") String changeNo);
/**
@ -87,4 +87,6 @@ public interface DsCraftMapper extends BaseMapper<DsCraftEntity> {
List<DsCraftEntity> selectDsCraftByPartIdAndRoamNo(@Param("partId") Long partId,@Param("roamNo") String roamNo);
DsCraftEntity selectDscraftByReworkOrder(@Param("changeNo") String changeNo);
List<DsCraftEntity> selectDsCraftByPartIdAndRank(@Param("partId")Long partId, @Param("rank")String rank);
}

@ -140,15 +140,15 @@
<select id="selectDsPartPage" resultMap="dsPartMap">
SELECT
t.*
FROM (
SELECT
p.*,
c.CRAFT_STATUS,
v.PART_VERSION
v.PART_VERSION,
ROW_NUMBER() OVER (PARTITION BY p.PART_CODE ORDER BY v.PART_VERSION DESC) AS rn
FROM DS_PART p
LEFT JOIN DS_CRAFT c ON p.ID = c.PART_ID
AND c.IS_DELETED = 0
LEFT JOIN DS_PART_VERSION v ON p.ID = v.PART_ID
AND v.IS_DELETED = 0
LEFT JOIN DS_PART_VERSION v ON p.ID = v.PART_ID AND v.IS_DELETED = 0
WHERE NOT EXISTS (
SELECT 1
FROM DS_PART_RELATION r
@ -156,37 +156,38 @@
AND r.IS_DELETED = 0
)
AND p.IS_DELETED = 0
AND c.RANK = 2
AND c.CRAFT_STATUS = 2
<if test="dsPart.plate != null and dsPart.plate != ''">
and p.PLATE = #{dsPart.plate}
AND p.PLATE = #{dsPart.plate}
</if>
<if test="dsPart.partCode != null ">
and p.PART_CODE = #{dsPart.partCode}
<if test="dsPart.partCode != null and dsPart.partCode != ''">
AND p.PART_CODE = #{dsPart.partCode}
</if>
<if test="dsPart.sinTerType != null ">
and p.SIN_TER_TYPE = #{dsPart.sinTerType}
<if test="dsPart.sinTerType != null and dsPart.sinTerType != ''">
AND p.SIN_TER_TYPE = #{dsPart.sinTerType}
</if>
<if test="dsPart.material != null and dsPart.material != ''">
and p.MATERIAL = #{dsPart.material}
AND p.MATERIAL = #{dsPart.material}
</if>
<if test="dsPart.powderWeight != null">
and p.POWDER_WEIGHT = #{dsPart.powderWeight}
AND p.POWDER_WEIGHT = #{dsPart.powderWeight}
</if>
<if test="dsPart.formingThickness != null">
and p.FORMING_THICKNESS = #{dsPart.formingThickness}
AND p.FORMING_THICKNESS = #{dsPart.formingThickness}
</if>
<if test="dsPart.startDate != null and dsPart.endDate != null">
and p.NEXT_DUE BETWEEN TO_DATE(#{dsPart.startDate}, 'YYYY-MM-DD')
AND TO_DATE(#{dsPart.endDate}, 'YYYY-MM-DD')
AND p.NEXT_DUE BETWEEN TO_DATE(#{dsPart.startDate}, 'YYYY-MM-DD')
AND TO_DATE(#{dsPart.endDate}, 'YYYY-MM-DD') + 1 - 1/86400
</if>
<if test="dsPart.partIds != null ">
<if test="dsPart.partIds != null and dsPart.partIds.size() > 0">
AND p.ID IN
<foreach collection="dsPart.partIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
ORDER BY p.CREATE_TIME desc ;
) t
WHERE t.rn = 1
ORDER BY t.PART_CODE
</select>

@ -51,6 +51,7 @@
and REWORK_CODE = #{reworkOrder}
and PART_CODE = #{partCode}
and BATCH_NO = #{batchNo}
order by PROCESS_NO
</select>
<select id="selectPrReworkProcessReworkNo"
resultType="org.springblade.desk.dashboard.pojo.entity.PrReworkProcessEntity">

@ -125,9 +125,10 @@ public interface IDsCraftService extends BaseService<DsCraftEntity> {
* 获取零件工艺
* @param partId 零件号
* @param rank 工艺等级
* @param roamNo B号
* @return
*/
DsCraftEntity getPartCraft(Long partId, String rank);
DsCraftEntity getPartCraft(Long partId, String rank,String roamNo);
/**
* 获取返工工艺
@ -206,4 +207,12 @@ public interface IDsCraftService extends BaseService<DsCraftEntity> {
* @return
*/
DsCraftEntity getReworkCraft(String changeNo);
/**
* 根据零件ID 工艺等级查询
* @param partId
* @param rank
* @return
*/
List<DsCraftEntity> getPartCraft(Long partId, String rank);
}

@ -226,9 +226,10 @@ public interface IDsPartService extends BaseService<DsPartEntity> {
* @param orders 工序编号
* @param partVersion 版本号
* @param rank 工艺级别
* @param roamNo B号
* @return 检验项目列表
*/
List<DsProcessProjectEntity> selectDsProcessProjectByPartNoAndPpsId(String partCode, String orders, String partVersion, String rank);
List<DsProcessProjectEntity> selectDsProcessProjectByPartNoAndPpsId(String partCode, String orders, String partVersion, String rank,String roamNo);
/**
* 查询老mes的子件信息

@ -195,8 +195,8 @@ public class DsCraftServiceImpl extends BaseServiceImpl<DsCraftMapper, DsCraftEn
}
@Override
public DsCraftEntity getPartCraft(Long partId, String newestVersion) {
return baseMapper.getPartCraft(partId, newestVersion);
public DsCraftEntity getPartCraft(Long partId, String newestVersion,String roamNo) {
return baseMapper.getPartCraft(partId, newestVersion,roamNo);
}
@Override
@ -367,4 +367,9 @@ public class DsCraftServiceImpl extends BaseServiceImpl<DsCraftMapper, DsCraftEn
public DsCraftEntity getReworkCraft(String changeNo) {
return craftMapper.selectDscraftByReworkOrder(changeNo);
}
@Override
public List<DsCraftEntity> getPartCraft(Long partId, String rank) {
return craftMapper.selectDsCraftByPartIdAndRank(partId,rank);
}
}

@ -120,7 +120,9 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit
List<DsPartVO> dsPartVOS = baseMapper.selectDsPartPage(page, dsPart);
if (!CollectionUtils.isEmpty(dsPartVOS)) {
for (DsPartVO dsPartVO : dsPartVOS) {
dsPartVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVO.getUpdateUser())).getData().getUser().getName());
if(null != dsPartVO.getUpdateUser()){
dsPartVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVO.getUpdateUser())).getData().getUser().getName());
}
String isSintering = dsPartVO.getIsSintering();
if (TaskingConstant.IS_SINTERING.equals(isSintering)) {
//查询子件信息
@ -306,19 +308,19 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit
if (!StringUtils.isEmpty(zPartCode)) {
//模糊查询零件
List<DsPartEntity> dsPartList = dsPartMapper.selectListPartByCodeLike(zPartCode);
//获取这些零件的最新版本号
List<DsPartVersionEntity> partVersionEntityList = partVersionService.selectListByPartCode(dsPartList);
// 提取零件ID列表
List<Long> zPartIdList = partVersionEntityList.stream()
.map(DsPartVersionEntity::getPartId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if(!CollectionUtils.isEmpty(dsPartList)){
//获取这些零件的最新版本号
List<DsPartVersionEntity> partVersionEntityList = partVersionService.selectListByPartCode(dsPartList);
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(null, null,null,null,zPartIdList);
// 提取零件ID列表
List<Long> zPartIdList = partVersionEntityList.stream()
.map(DsPartVersionEntity::getPartId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(null, null,null,null,zPartIdList);
}
}
return new ArrayList<>();
@ -550,14 +552,14 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit
}
@Override
public List<DsProcessProjectEntity> selectDsProcessProjectByPartNoAndPpsId(String partCode, String orders, String partVersion, String rank) {
public List<DsProcessProjectEntity> selectDsProcessProjectByPartNoAndPpsId(String partCode, String orders, String partVersion, String rank,String roamNo) {
// 根据零件号、版本号查询零件版本信息信息
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartCodeAndPartVersion(partCode, partVersion);
if (partVersionEntity == null) {
return List.of();
}
// 根据零件ID、工艺等级查询工艺信息
DsCraftEntity partCraft = craftService.getPartCraft(partVersionEntity.getPartId(), rank);
DsCraftEntity partCraft = craftService.getPartCraft(partVersionEntity.getPartId(), rank,roamNo);
if (partCraft == null) {
return List.of();
}
@ -652,7 +654,7 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit
@Override
public DsPartVersionEntity getNewPartVersion(String partCode) {
if (StringUtils.isEmpty(partCode)) {
if (!StringUtils.isEmpty(partCode)) {
List<DsPartVersionEntity> partVersionEntityList = partVersionService.selectByPartCode(partCode);
Optional<DsPartVersionEntity> maxEntity = partVersionEntityList.stream()
.filter(entity -> entity.getPartVersion() != null)

@ -160,62 +160,62 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
@Override
public IPage<DsTaskingVO> selectAssignList(IPage<DsTaskingVO> page, DsTaskingVO dsTasking) {
List<DsTaskingVO> dsTaskingVOS = baseMapper.selectDsTaskingPage(page, dsTasking);
if(!CollectionUtils.isEmpty(dsTaskingVOS)){
for (DsTaskingVO dsTaskingVO : dsTaskingVOS) {
String partCode = dsTaskingVO.getPartCode();
String version = dsTaskingVO.getVersion();
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(partCode,version);
// if(TaskingConstant.IS_SINTERING.equals(partEntity.getIsSintering())){
// //查询子件信息
// if(!CollectionUtils.isEmpty(dsTaskingVOS)){
// for (DsTaskingVO dsTaskingVO : dsTaskingVOS) {
// String partCode = dsTaskingVO.getPartCode();
// String version = dsTaskingVO.getVersion();
// DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(partCode,version);
//// if(TaskingConstant.IS_SINTERING.equals(partEntity.getIsSintering())){
//// //查询子件信息
//// List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(partEntity.getId());
//// //获取所有子件ID
//// List<Long> idList = partRelationEntityList.stream().map(DsPartRelationEntity::getChildPartId).collect(Collectors.toList());
//// if(CollectionUtils.isEmpty(idList)){
//// continue;
//// }
//// //获取版本号 根据子件ID
//// List<DsPartVersionEntity> partVersionList = partVersionService.selectByPartIds(idList);
//// List<DsTaskingIsCompletedVO> list = new ArrayList<>();
//// for (DsPartVersionEntity dsPartVersionEntity : partVersionList) {
//// //根据零件编码 和 版本号查询数据
//// List<Integer> taskStatusList = new ArrayList<>(Arrays.asList(
//// TaskingConstant.TASK_STATUS_WAIT,
//// TaskingConstant.TASK_STATUS_ALREADY,
//// TaskingConstant.TASK_STATUS_UNDERWAY
//// ));
//// List<DsTaskingEntity> dsTaskingEntityList = taskingMapper.selectDsTaskingByPartCodeAndVersion(dsPartVersionEntity.getPartCode(), dsPartVersionEntity.getPartVersion(), taskStatusList);
////
//// List<DsTaskingIsCompletedVO> collect = dsTaskingEntityList.stream()
//// .map(entity -> {
//// DsTaskingIsCompletedVO vo = new DsTaskingIsCompletedVO();
//// BeanUtils.copyProperties(entity, vo);
//// return vo;
//// })
//// .collect(Collectors.toList());
////
//// list.addAll(collect);
//// }
////
//// if(!CollectionUtils.isEmpty(list)){
//// dsTaskingVO.setChildren(list);
//// }
//// }
//
// //查询子件信息
// if(null != partEntity){
// List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(partEntity.getId());
// //获取所有子件ID
// List<Long> idList = partRelationEntityList.stream().map(DsPartRelationEntity::getChildPartId).collect(Collectors.toList());
// if(CollectionUtils.isEmpty(idList)){
// continue;
// }
// //获取版本号 根据子件ID
// List<DsPartVersionEntity> partVersionList = partVersionService.selectByPartIds(idList);
// List<DsTaskingIsCompletedVO> list = new ArrayList<>();
// for (DsPartVersionEntity dsPartVersionEntity : partVersionList) {
// //根据零件编码 和 版本号查询数据
// List<Integer> taskStatusList = new ArrayList<>(Arrays.asList(
// TaskingConstant.TASK_STATUS_WAIT,
// TaskingConstant.TASK_STATUS_ALREADY,
// TaskingConstant.TASK_STATUS_UNDERWAY
// ));
// List<DsTaskingEntity> dsTaskingEntityList = taskingMapper.selectDsTaskingByPartCodeAndVersion(dsPartVersionEntity.getPartCode(), dsPartVersionEntity.getPartVersion(), taskStatusList);
//
// List<DsTaskingIsCompletedVO> collect = dsTaskingEntityList.stream()
// .map(entity -> {
// DsTaskingIsCompletedVO vo = new DsTaskingIsCompletedVO();
// BeanUtils.copyProperties(entity, vo);
// return vo;
// })
// .collect(Collectors.toList());
//
// list.addAll(collect);
// }
//
// if(!CollectionUtils.isEmpty(list)){
// dsTaskingVO.setChildren(list);
// if (!CollectionUtils.isEmpty(idList)) {
// List<DsPartVersionVO> dsPartEntityList = partService.selectDsPartVersionByIds(idList);
//// for (DsPartVersionVO dsPartVersionVO : dsPartEntityList) {
//// dsPartVersionVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVersionVO.getUpdateUser())).getData().getUser().getName());
//// }
// dsTaskingVO.setChildren(dsPartEntityList);
// }
// }
//查询子件信息
if(null != partEntity){
List<DsPartRelationEntity> partRelationEntityList = partRelationService.selectDsPartRelationByPartId(partEntity.getId());
//获取所有子件ID
List<Long> idList = partRelationEntityList.stream().map(DsPartRelationEntity::getChildPartId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(idList)) {
List<DsPartVersionVO> dsPartEntityList = partService.selectDsPartVersionByIds(idList);
// for (DsPartVersionVO dsPartVersionVO : dsPartEntityList) {
// dsPartVersionVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVersionVO.getUpdateUser())).getData().getUser().getName());
// }
dsTaskingVO.setChildren(dsPartEntityList);
}
}
}
}
// }
// }
return page.setRecords(dsTaskingVOS);
}
@ -306,7 +306,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
if(dsTaskingEntity.getTaskType().equals(TaskingConstant.REWORK_PLAN_EDIT)){
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(dsTaskingEntity.getPartCode(),dsTaskingEntity.getVersion());
//返工单号 返工工艺
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(), partEntity.getPartCode(), dsTaskingEntity.getVersion());
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(), partEntity.getPartCode(), dsTaskingEntity.getBatchNo());
if(CollectionUtils.isEmpty(reworkProcessEntityList)){
throw new ServiceException("返工工序缺失");
}
@ -314,7 +314,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
if(null == prReworkProcessEntity.getMakeTeam() && null == prReworkProcessEntity.getOcId()){
throw new ServiceException("外协厂商或加工班组为空");
}
BsProcessSetEntity processSet = processSetService.selectBsProcessSetByProcessCode(prReworkProcessEntity.getProcessNo());
BsProcessSetEntity processSet = processSetService.getById(prReworkProcessEntity.getPpsId());
if(TaskingConstant.IS_CHECKOUT.equals(processSet.getIsCheckout()) ){
List<DsProcessProjectEntity> processProjectEntities = processProjectService.selectDsProcessProjectByProcessId(prReworkProcessEntity.getId());
if(CollectionUtils.isEmpty(processProjectEntities)){
@ -331,25 +331,25 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
//查询零件和子件是否编制工序
//零件工艺
DsCraftEntity craft = craftService.getPartCraft(partEntity.getId(),"2");
if(null == craft){
List<DsCraftEntity> craftEntityList = craftService.getPartCraft(partEntity.getId(),"2");
if(CollectionUtils.isEmpty(craftEntityList) ){
throw new ServiceException("零件工艺缺失");
}
//零件工序
List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craft.getId());
if(CollectionUtils.isEmpty(processEntities)){
throw new ServiceException("【零件号】"+partEntity.getPartCode()+"工艺未编制工序");
}
//判断工序下的检验项目
for (DsProcessEntity processEntity : processEntities) {
BsProcessSetEntity processSet = processSetService.selectBsProcessSetByProcessCode(processEntity.getProcessCode());
if(TaskingConstant.IS_CHECKOUT.equals(processSet.getIsCheckout()) ){
List<DsProcessProjectEntity> processProjectEntities = processProjectService.selectDsProcessProjectByProcessId(processEntity.getId());
if(CollectionUtils.isEmpty(processProjectEntities)){
throw new ServiceException(processEntity.getProcessName()+":未编制检验项目");
}
}
}
// //零件工序
// List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craft.getId());
// if(CollectionUtils.isEmpty(processEntities)){
// throw new ServiceException("【零件号】"+partEntity.getPartCode()+"工艺未编制工序");
// }
// //判断工序下的检验项目
// for (DsProcessEntity processEntity : processEntities) {
// BsProcessSetEntity processSet = processSetService.selectBsProcessSetByProcessCode(processEntity.getProcessCode());
// if(TaskingConstant.IS_CHECKOUT.equals(processSet.getIsCheckout()) ){
// List<DsProcessProjectEntity> processProjectEntities = processProjectService.selectDsProcessProjectByProcessId(processEntity.getId());
// if(CollectionUtils.isEmpty(processProjectEntities)){
// throw new ServiceException(processEntity.getProcessName()+":未编制检验项目");
// }
// }
// }
//子件工艺
@ -358,20 +358,24 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
DsPartEntity zPartEntity = partService.getById(dsPartRelationEntity.getChildPartId());
if(null != zPartEntity){
//检验子件超期
if(null == zPartEntity.getNextDue()){
throw new ServiceException("【子件号】"+zPartEntity.getPartCode()+"工艺超期");
}
Date nextDue = zPartEntity.getNextDue();
if (nextDue.before(new Date())) {
throw new ServiceException("【零件号】"+zPartEntity.getPartCode()+"工艺超期");
throw new ServiceException("【件号】"+zPartEntity.getPartCode()+"工艺超期");
}
}
assert zPartEntity != null;
if(null != zPartEntity.getSinTerType()){
DsCraftEntity zCraft = craftService.getPartCraft(zPartEntity.getId(),"2");
if(null == zCraft){
List<DsCraftEntity> zCraftList = craftService.getPartCraft(zPartEntity.getId(),"2");
if(CollectionUtils.isEmpty(zCraftList) ){
throw new ServiceException("子件工艺缺失");
}
List<DsProcessEntity> zProcessEntities = processService.selectDsProcessByCraftId(zCraft.getId());
if(CollectionUtils.isEmpty(zProcessEntities)){
throw new ServiceException("【子件号】工艺未编制工序");
}
// List<DsProcessEntity> zProcessEntities = processService.selectDsProcessByCraftId(zCraft.getId());
// if(CollectionUtils.isEmpty(zProcessEntities)){
// throw new ServiceException("【子件号】工艺未编制工序");
// }
//判断工序下的检验项目
// for (DsProcessEntity zProcessEntity : zProcessEntities) {
@ -384,8 +388,8 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
// }
// }
zCraft.setCraftStatus(TaskingConstant.IN_USE);
craftService.updateById(zCraft);
// zCraft.setCraftStatus(TaskingConstant.IN_USE);
// craftService.updateById(zCraft);
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(zPartEntity.getId());
// 5新图任务 - 磨具计划下发 对接坤哥
@ -413,8 +417,8 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
taskingMapper.updateById(dsTaskingEntity);
//4.更新零件、子件当前版本的工艺任务状态为【使用中】
craft.setCraftStatus(TaskingConstant.IN_USE);
craftService.updateById(craft);
// craft.setCraftStatus(TaskingConstant.IN_USE);
// craftService.updateById(craft);
}
@ -530,10 +534,13 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
List<DsPartVersionVO> dsPartEntityList = partService.selectDsPartVersionByIds(idList);
for (DsPartVersionVO dsPartVersionVO : dsPartEntityList) {
// dsPartVersionVO.setUpdateUserStr(userClient.userInfo(Func.toLong(dsPartVersionVO.getUpdateUser())).getData().getUser().getName());
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(dsPartVersionVO.getId());
dsPartVersionVO.setPartVersion(partVersionEntity.getPartVersion());
if(null != dsPartVersionVO.getSinTerType()){
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(dsPartVersionVO.getId());
dsPartVersionVO.setPartVersion(partVersionEntity.getPartVersion());
dsTaskingVO.setChildren(dsPartEntityList);
}
}
dsTaskingVO.setChildren(dsPartEntityList);
}
}
}
@ -770,7 +777,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
if(null != craft){
//查询返工工序
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(),dsTaskingEntity.getPartCode(),dsTaskingEntity.getVersion());
List<PrReworkProcessEntity> reworkProcessEntityList = reworkProcessService.selectPrReworkProcess(dsTaskingEntity.getReworkOrder(),dsTaskingEntity.getPartCode(),dsTaskingEntity.getBatchNo());
if(!CollectionUtils.isEmpty(reworkProcessEntityList)){
List<Long> reworkProcessId = reworkProcessEntityList.stream()
.map(PrReworkProcessEntity::getId)
@ -790,52 +797,58 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
result.getCraftList().add(craftTree);
}else{
// 没有返工工艺信息的情况
// 创建新的工艺实体并设置返工订单号
// craft = new DsCraftEntity();
// craft.setReworkOrder(dsTaskingEntity.getReworkOrder());
// craft.setPartId(partEntity.getId());
// craft.setPartVersions(dsTaskingEntity.getVersion());
// // 创建工艺节点并设置craftInfo
// craftTree.setCraftInfo(JSONObject.from(craft));
// craftTree.setProcessList(new ArrayList<>());
// result.getCraftList().add(craftTree);
// 查询零件工艺信息
List<DsCraftVO> dsCraftVOList = craftService.selectDsCraftByPartId(partEntity.getId(), "2");
if(CollectionUtils.isEmpty(dsCraftVOList)){
throw new ServiceException("零件工艺信息有误 请检查该零件是否有工艺信息");
}
if (!CollectionUtils.isEmpty(dsCraftVOList)) {
for (DsCraftVO craftVO : dsCraftVOList) {
craftVO.setReworkOrder(dsTaskingEntity.getReworkOrder());
craftVO.setPartId(partEntity.getId());
craftVO.setPartVersions(dsTaskingEntity.getVersion());
// 查询工序信息
List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craftVO.getId());
if (!CollectionUtils.isEmpty(processEntities)) {
List<Long> processIds = processEntities.stream()
.map(DsProcessEntity::getId)
.collect(Collectors.toList());
// 批量查询关联数据
List<DsProcessProjectEntity> processProjectEntityList = processProjectService.selectDsProcessProjectByProcessIds(processIds);
List<DsProcessMeasuringToolEntity> processMeasuringToolEntityList = processMeasuringToolService.selectDsProcessMeasuringToolByProcessIds(processIds);
List<DsProcessMoldToolEntity> processMoldToolEntityList = processMoldToolService.selectDsProcessMoldToolByProcessIds(processIds);
// 没有返工工艺信息的情况
// 创建新的工艺实体并设置返工订单号
craft = new DsCraftEntity();
craft.setReworkOrder(dsTaskingEntity.getReworkOrder());
craft.setPartId(partEntity.getId());
craft.setPartCode(partEntity.getPartCode());
craft.setPartVersions(dsTaskingEntity.getBatchNo());
// 创建工艺节点并设置craftInfo
craftTree.setCraftInfo(JSONObject.from(craft));
craftTree.setProcessList(new ArrayList<>());
result.getCraftList().add(craftTree);
// 构建工序树
List<ProcessTreeVO> processTree = buildProcessTree(processEntities, processProjectEntityList,
processMeasuringToolEntityList, processMoldToolEntityList);
craftTree.setProcessList(processTree);
}
result.getCraftList().add(craftTree);
}
}
// // 查询零件工艺信息
// List<DsCraftVO> dsCraftVOList = craftService.selectDsCraftByPartId(partEntity.getId(), "2");
// if(CollectionUtils.isEmpty(dsCraftVOList)){
// throw new ServiceException("零件工艺信息有误 请检查该零件是否有工艺信息");
// }
//
// if (!CollectionUtils.isEmpty(dsCraftVOList)) {
// for (DsCraftVO craftVO : dsCraftVOList) {
// // 每次循环创建新的craftTree对象
// CraftTreeVO craftTree1 = new CraftTreeVO();
//
// craftVO.setReworkOrder(dsTaskingEntity.getReworkOrder());
// craftVO.setPartId(partEntity.getId());
// craftVO.setPartVersions(dsTaskingEntity.getVersion());
//
// craftTree1.setCraftInfo(JSONObject.from(craftVO));
//
// // 查询工序信息
// List<DsProcessEntity> processEntities = processService.selectDsProcessByCraftId(craftVO.getId());
//
// if (!CollectionUtils.isEmpty(processEntities)) {
// List<Long> processIds = processEntities.stream()
// .map(DsProcessEntity::getId)
// .collect(Collectors.toList());
//
// // 批量查询关联数据
// List<DsProcessProjectEntity> processProjectEntityList = processProjectService.selectDsProcessProjectByProcessIds(processIds);
// List<DsProcessMeasuringToolEntity> processMeasuringToolEntityList = processMeasuringToolService.selectDsProcessMeasuringToolByProcessIds(processIds);
// List<DsProcessMoldToolEntity> processMoldToolEntityList = processMoldToolService.selectDsProcessMoldToolByProcessIds(processIds);
//
// // 构建工序树
// List<ProcessTreeVO> processTree = buildProcessTree(processEntities, processProjectEntityList,
// processMeasuringToolEntityList, processMoldToolEntityList);
// craftTree1.setProcessList(processTree);
// }
//
// result.getCraftList().add(craftTree1);
// }
// }
}
return result;
@ -993,11 +1006,19 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
// todo 查审理单 获取返修原因
// 2. 保存任务信息
if(TaskingConstant.TASK_STATUS_ALREADY.equals(dsTasking.getTaskStatus())){
dsTasking.setTaskStatus(TaskingConstant.TASK_STATUS_UNDERWAY);
}
int taskInsert = taskingMapper.insert(dsTasking);
if (taskInsert <= 0) {
throw new RuntimeException("返工任务插入失败:" + reworkOrder);
}
if(null == yieldOrder){
log.info("返工任务同步成功,未同步工艺工序:{}", reworkOrder);
return true;
}
// 3. 获取零件信息
DsPartEntity partEntity = partService.selectDsPartByPatCodeAndVersion(partCode, partVersion);
if (partEntity == null) {
@ -1005,12 +1026,13 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
}
// 4. 创建返工工艺
DsCraftEntity craftEntity = createReworkCraft(partEntity, partVersion, reworkOrder);
DsCraftEntity craftEntity = createReworkCraft(partEntity, batchNo, reworkOrder);
boolean saveCraft = craftService.save(craftEntity);
if (!saveCraft) {
throw new RuntimeException("返工工艺添加失败:" + reworkOrder);
}
// 5. 查询并添加工序、加工班组、外协厂商
addReworkProcesses(partEntity, yieldOrder, reworkOrder);
@ -1021,14 +1043,15 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
/**
* 创建返工工艺实体
*/
private DsCraftEntity createReworkCraft(DsPartEntity partEntity, String partVersion, String reworkOrder) {
private DsCraftEntity createReworkCraft(DsPartEntity partEntity, String batchNo, String reworkOrder) {
DsCraftEntity craftEntity = new DsCraftEntity();
craftEntity.setPartId(partEntity.getId());
craftEntity.setPrority(3);
craftEntity.setRank("2");
craftEntity.setPartVersions(partVersion);
craftEntity.setPartVersions(batchNo);
craftEntity.setReworkOrder(reworkOrder);
craftEntity.setCraftStatus("3");
craftEntity.setPartCode(partEntity.getPartCode());
return craftEntity;
}
@ -1128,7 +1151,7 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
//保存工艺信息
if(null == craft.getId()){
craft.setPrority(3);
craft.setRank("2");
craft.setRank("2");;
craftService.save(craft);
}else {
craftService.updateById(craft);
@ -1555,8 +1578,8 @@ public class DsTaskingServiceImpl extends BaseServiceImpl<DsTaskingMapper, DsTas
// 3. 处理成功后新增任务记录
DsPartVersionEntity partVersionEntity = partVersionService.selectByPartId(newPart.getId());
//修改状态
if(dsTasking.getTaskStatus().equals(1)){
dsTasking.setTaskStatus(2);
if(TaskingConstant.TASK_STATUS_ALREADY.equals(dsTasking.getTaskStatus())){
dsTasking.setTaskStatus(TaskingConstant.TASK_STATUS_UNDERWAY);
}
dsTasking.setVersion(partVersionEntity.getPartVersion());
int taskingInsert = taskingMapper.insert(dsTasking);

@ -68,7 +68,7 @@ public class PrReworkProcessServiceImpl extends BaseServiceImpl<PrReworkProcessM
@Override
public List<PrReworkProcessEntity> selectPrReworkProcess(String reworkOrder, String partCode, String batchNo) {
return reworkProcessMapper.selectPrReworkProcess(reworkOrder, reworkOrder,partCode);
return reworkProcessMapper.selectPrReworkProcess(reworkOrder, partCode,batchNo);
}
@Override

@ -1568,7 +1568,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
YieldOrder yieldOrder = yieldOrderService.getById(workOrder.getYoId());
// 根据零件号、工序ID、版本号、工艺级别查询对应的检验项目
List<DsProcessProjectEntity> projects = dsPartService.selectDsProcessProjectByPartNoAndPpsId(workOrder.getPartCode(), workPlan.getOrders(), yieldOrder.getPartVersion(), yieldOrder.getRank());
List<DsProcessProjectEntity> projects = dsPartService.selectDsProcessProjectByPartNoAndPpsId(workOrder.getPartCode(), workPlan.getOrders(), yieldOrder.getPartVersion(), yieldOrder.getRank(),yieldOrder.getRoamNo());
if (CollectionUtils.isNotEmpty(projects)) {
// 保存检验任务
InspectionTask inspectionTask = new InspectionTask();

Loading…
Cancel
Save